Cannot translate the value of keypath 'auth.failed'. Use the value of keypath as default.
See original GitHub issuePackages
"vue": "^2.6.6",
"vue-i18n": "^8.8.2",
"@kirschbaum-development/laravel-translations-loader": "^0.4.2",
I’m doing a simple test:
app.js has the following code among other things
window.Vue = require('vue');
import VueI18n from 'vue-i18n';
import languageBundle from '@kirschbaum-development/laravel-translations-loader/php?parameters={{ $1 }}!@kirschbaum-development/laravel-translations-loader';
Vue.use(VueI18n);
const fallbackLocale = 'en';
const i18n = new VueI18n({
fallbackLocale,
locale: 'en',
messages: languageBundle
});
ExampleComponent.vue has the following code among other things
{{ $t('auth.failed') }}
This will produce the error:
Cannot translate the value of keypath 'auth.failed'. Use the value of keypath as default.
But if i do this:
const i18n = new VueI18n({
fallbackLocale,
locale: 'en',
messages: {
en: {
auth: {
failed: 'For real?!'
}
},
}
});
It works… so, any ideas why it is not liking the languageBundle
? Anything missing or wrong?
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Vue: vue-i18n: Cannot translate the value of keypath, Use the ...
Cannot translate the value of keypath 'NavbarMobile.home'. Use the value of keypath as default. I checked if the plugin is working by console....
Read more >Cannot translate the value of keypath 'message.welcome ...
I get this error: vue-i18n.common.js:16 [vue-i18n] Cannot translate the value of keypath 'message.welcome'. Use the value of keypath as default.
Read more >I18n - Cannot translate the value of keypath - Vue Forum
Hello everyone, I am using i18n for translations on my website. It was working fine till 6th October 2018, but I'm getting the...
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 >[vue-i18n] Cannot translate the value of keypath 'message ...
This is my en.json: { "message": "hello i18n !!" } my i18n.ts. import Vue from "vue"; import VueI18n, { LocaleMessages } from "vue-i18n";....
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
@Morinohtar The problem was the path separators on windows. That is fixed on version 0.4.4 if you want to upgrade.
Ok, I’m going to try to replicate this in a windows environment over the weekend. In the meantime, using the instructions noted here (https://github.com/kirschbaum-development/laravel-translations-loader#using-a-different-folder) under the
Using a different folder
here should probably solve your issue.Basically you need:
1 - Create an
index.js
file in theresources/lang
directory. 2 - Change your import to:import languageBundle from '@kirschbaum-development/laravel-translations-loader/php?parameters={{ $1 }}!@kirschbaum-development/laravel-translations-loader!./../lang/index.js';
Let me know if that works.