Easier way to set attribute directly?
See original GitHub issueFirst of all, great project! Your blog post about vue-i18n resonates.
But I wonder if it’s a way to set attributes more directly. Let’s say I have this image where I want to localize the alt text:
<img :src="logo" alt="Logo of company X" />
As I understand it, I can do:
<img :src="logo" v-bind="$ta('logo')" />
And have a .ftl
definition of:
logo =
.alt = Logo of company X
Is it possible to set it more directly? In vue-i18n-next
I can reference the language tag directly:
<img :src="logo" :alt="t('logoAltText')" />
As I understand it, this is not supported now, or maybe it is? If not, do you think it could be? I see the $ta
pattern great for translating two or more attributes, but if there is only one, it would be nice to reference the language tag directly?
Again thank you for your work!
EDIT Solved, see my reply to myself 😄
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Element.setAttribute() - Web APIs | MDN
Using setAttribute() to modify certain attributes, most notably value in XUL, works inconsistently, as the attribute specifies the default value ...
Read more >What is the point to use the setAttribute method when there is ...
It's useful when you want to set an attribute which can't be a property of the node (because there's already a property with...
Read more >5 Ways to Control Attributes in Python. An Example Led Guide
Another way to control the value of attributes is via a custom decorator. In keeping with our theme, let's create the same class,...
Read more >use always get and set methods is a bad practique, is call ...
I think that in OOP you always should call an attribute by the get method. For example: On set public setAtribute(Atribute atr){ this.atr...
Read more >Python: How to directly modifying an attributes value - YouTube
Learning Apache Airflow with Python in easy way in 40 Minutes · 4-5: Attributes in XML Files · Python: How to modify an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
By googling “fluent vue” or “vue fluent” I believe 😃
I asked around at my company’s slack channel for tips about i18n, and another team recommended me projectfluent with weblate as localization tool. So far so good!
By the way there is a Pontoon project by Mozilla. If you need a self-hosted alternative to Weblate