[vue-i18n] Cannot translate the value of keypath...
See original GitHub issuevue & vue-i18n version
ex: 2.0.0-beta.3, 4.1.0
Steps to reproduce
// main.js
import Vue from 'vue'
import VueResource from 'vue-resource'
import VueI18n from 'vue-i18n'
import router from './router/routes.js'
import App from './App'
// =======================
// Store
// =======================
Vue.use(VueResource)
// =======================
// Localization
// =======================
Vue.use(VueI18n)
// let self = this
const lang = 'de'
Vue.locale(lang, function () {
// self.loading = true
return fetch('../static/lang_' + lang + '.json', {
method: 'get',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}).then(function (res) {
return res.json()
}).then(function (json) {
// self.loading = false
if (Object.keys(json).length === 0) {
return Promise.reject(new Error('locale empty !!'))
} else {
return Promise.resolve(json)
}
}).catch(function (error) {
// self.error = error.message
console.error(error.message)
return Promise.reject()
})
}, function () {
Vue.config.lang = lang
})
/* eslint-disable no-new */
new Vue({
router,
render: h => h(App),
http: {
root: '/root',
headers: {
Authorization: 'Basic YXBpOnBhc3N3b3Jk'
}
}
}).$mount('app')
//lang_de.json
{
"apptitle": "App erstellen",
"headnav": {
"help": "Hilfe / FAQ",
"register": "Registrieren",
"login": "Anmelden"
}
}
// Template
<template lang="pug">
header.brandbar
h1.brand__title {{ $t("apptitle") }}
</template>
What is Expected?
No warnings 😃
What is actually happening?
I try to use your plugin with webpack and vue, and it does what it says - apptitle
is rendered as App erstellen
, but i get annoying console-warnings:
[vue-i18n] Cannot translate the value of keypath "apptitle". Use the value of keypath as default
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Vue: vue-i18n: Cannot translate the value of keypath, Use ...
I am using Vue, and I want to show three languages. English, Tagalog and Cebuano. Now I have the error. Cannot translate the...
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 ...
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
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'. ...
[vue-i18n] Cannot translate the value of keypath 'message'. Use the value of keypath as default. #1150. jackDani16 posted onGitHub.
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
Hmm. I think that we can resolve with using callback of
Vue.locale
andv-cloak
. e.g. http://jsfiddle.net/kazupon/Lh980stL/8/Yeah - just a bit problematic when you have a lot of other dependencies that further delays when you can instantiate vue app instance.
I would much prefer if we could set a variable like “hasLoadedTranslations” on the instance and only then will translations be set.