feat: i18n与jetcache

This commit is contained in:
2023-11-16 10:04:27 +08:00
parent d366daeccc
commit ac856ed2f6
24 changed files with 476 additions and 114 deletions

View File

@@ -0,0 +1,31 @@
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import locale from 'element-ui/lib/locale'
import zh from './langs/zh-CN'
import en from './langs/en'
import id from './langs/id'
import indonesian from './langs/in'
Vue.use(VueI18n)
const messages = {
en: {
...en
},
zh: {
...zh
},
id: {
...id
},
in: {
...indonesian
}
}
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: 'en'
})
locale.i18n((key, value) => i18n.t(key, value))
export default i18n