SFC and Cannot translate the value of keypath...
See original GitHub issueThis is not exactly an issue of vue-i18n-loader, I am writing it as a reminder for others that may face this problem: if, inside a single file component, you get the error “Cannot translate the value of keypath…”, it may be cause by npm cache.
Solution:
- Check, double check that your vue-i18n-loader has been properly configured
- Add a syntax error inside the
<i18n>{...}</i18n>
tag - Check that webpack does not compile because the loader complains about the syntax error (if it doesn’t, than you didn’t configure properly the vue-i18n-loader inside webpack config file)
- Remove the syntax error
- Remove node_modules folder (the whole folder, not just the i18n folders)
- run npm cache clean
- run npm install
After that, it worked for me (and my colleagues facing the same problem).
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:11 (1 by maintainers)
Top Results From Across the Web
vue-i18n Cannot translate the value of keypath - Stack Overflow
I cannot get the translations to work every single one get the Cannot translate the value of keypath. the config looks like this...
Read more >Storybook + Vuejs + vue-18n : translate strings from sfc i18n ...
Storybook + Vuejs + vue-18n : translate strings from sfc i18n section but not root messages ... [vue-i18n] Cannot translate the value of...
Read more ><i18n> in TypeScript SFC not able to translate value - Get Help
Almost. The first message about the key not being a string is gone. Now this remains: [vue-i18n] Cannot translate the value of keypath...
Read more >Cannot translate the value of keypath - Laracasts
Hi! Have this error on every place i set text app.js:32228 [vue-i18n] Cannot translate the value of keypath What is the problem ?...
Read more >Breaking Changes - Vue I18n
Similar to Translation API return value, the pluralization API like ... In Vue I18n v9 or later, you can't use array-like objects for...
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
Indeed there is.
As @Kouty 's say; you need to change root component’s
$i18n
. So there is$root
instance property (which reach to the App.vue) available in every component or sub component in your Vue instance. İnstead of changingthis.$i18n.locale
you can changethis.$root.$i18n.locale = newVal
in template tags just$root.$i18n.locale = newVal
.No need to emiting events, watching props etc.