VueJs and vue-i18n error
Well, You can check the author's another repo.
https://github.com/kazupon/vue-i18n-alpha-repro
In the demo, the vue-i18n
is like:
import Vue from 'vue'import App from './App'import VueI18n from 'vue-i18n'import router from './router'Vue.use(VueI18n)const i18n = new VueI18n({ locale: 'ja', messages: { ja: { hello: 'こんにちは' }, en: { hello: 'hello' } } }) Vue.config.productionTip = false /* eslint-disable no-new */ new Vue({ el: '#app', router, i18n, template: '<App/>', components: { App } })
And it works.
import Vue from 'vue'import VueI18n from 'vue-i18n'Vue.use(VueI18n)// console.log(navigator.language);let defaultLang = "zh"const i18n = new VueI18n({ locale: defaultLang,//默认语言 messages: { zh:{ hello:'你好', footTitle:['现货交易','采购供应','行情资讯','个人中心'] }, en: { hello: 'hello', footTitle:['Spot Trading','Purchase & Supply','Market Information','Personal Center'] }, }})export default i18n