question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot translate the value of keypath 'auth.failed'. Use the value of keypath as default.

See original GitHub issue

Packages

"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:closed
  • Created 5 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
luisdalmolincommented, Mar 9, 2019

@Morinohtar The problem was the path separators on windows. That is fixed on version 0.4.4 if you want to upgrade.

1reaction
luisdalmolincommented, Mar 9, 2019

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 the resources/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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found