You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
722 B
27 lines
722 B
import Vue from 'vue'
|
|
import VueI18n from 'vue-i18n'
|
|
import locale from 'element-ui/lib/locale'
|
|
import zh from './langs/chinese'
|
|
import en from './langs/english'
|
|
import vietnamese from './langs/Vietnamese'
|
|
Vue.use(VueI18n)
|
|
const messages = {
|
|
en: {
|
|
...en
|
|
},
|
|
zh: {
|
|
...zh
|
|
},
|
|
vi: {
|
|
...vietnamese
|
|
}
|
|
}
|
|
const i18n = new VueI18n({
|
|
locale: localStorage.lang || 'zh',
|
|
messages,
|
|
silentTranslationWarn: true, // 解决vue-i18n黄色警告"value of key 'xxx' is not a string"和"cannot translate the value of keypath 'xxx'.use the value of keypath as default",可忽略
|
|
globalInjection: true, // 全局注入
|
|
fallbackLocale: 'zh'
|
|
})
|
|
locale.i18n((key, value) => i18n.t(key, value))
|
|
export default i18n
|
|
|