v-t attributes in a <router-link /> element does not translate when changing $i18n.locale
See original GitHub issuevue & vue-i18n version
Vue 2.5.17-beta.0 Vue-i18n 7.6.0
Steps to reproduce
<template v-for="category in CATEGORIES">
<router-link :to="{}" class="category" :key="category.category">
<div class="column title-description">
<div class="title" v-t="category.category">
<div class="description" v-t="category.category + '_description'" />
</div>
</router-link>
</template>
What is Expected?
When I change $i18n.locale all v-t attributes should be translated.
What is actually happening?
The translations doesn’t render. If I change at least one of the v-t attributes to interpolation with $t it actually works, even on the v-t attributes.
Code sample that works perfectly:
<template v-for="category in CATEGORIES">
<router-link :to="{}" class="category" :key="category.category">
<div class="column title-description">
<div class="title">{{ $t(category.category) }}</div>
<div class="description" v-t="category.category + '_description'" />
</div>
</router-link>
</template>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:8
Top Results From Across the Web
The Ultimate Guide to Vue Localization with Vue I18n - Medium
This end-to-end tutorial will give you a deep insight into Vue localization with the extremely popular Vue I18n library for you to take...
Read more >Vue I18N Adding Locale To The Url Using Routerview - ADocLib
vt attributes in a routerlink / element does not translate when changing i18n.locale #399.Kansuler posted onGitHub.! BUG REPORT TEMPLATE.
Read more >i18n component | fluent-vue
Message attributes are passed as scoped slot parameters. This allows to not split translation into multiple messages. And attributes have access to same ......
Read more >Angular i18n for text containing routerLink and requires ...
2 Answers 2 · But then you are maintaining code in your translation files. If the href needs to change, or you need...
Read more >The Ultimate Vue Localization Guide | Phrase
Note » To focus on the i18n, we won't show any CSS styling in this ... a region subtag (like en-US ) to...
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
I also have this problem. But it happens inside a
<router-view />
of a Vuetify application. None of the v-t are working. Outside seems ok.routes
Seeing a similar issue on my playground application. It seems that the language update isnt’ immediately adopted for elements using the
v-t
directive. However, it gets updated the new time the component is re-rendered. In case of the playground app mentioned above: changing the language (here: via the top-right button) does not update the texts in the menu and header, until I toggle the menu again, or perform any route change (some texts are actually adopted - those are using$t
, mostly in places wherev-t
could not be used).