78 lines
1.9 KiB
JavaScript
78 lines
1.9 KiB
JavaScript
|
/*
|
||
|
* @Descripttion:
|
||
|
* @version:
|
||
|
* @Author: kBank
|
||
|
* @Date: 2022-07-05 17:57:49
|
||
|
*/
|
||
|
import Vue from 'vue'
|
||
|
import VueI18n from 'vue-i18n'
|
||
|
// import zhCn from 'zhCN'
|
||
|
// import enUS from 'enUS'
|
||
|
// import zhTC from 'zhTC'
|
||
|
// import ruRU from 'ruRU'
|
||
|
// import frFR from 'frFR'
|
||
|
var localenUS = {}
|
||
|
var localzhCN = {}
|
||
|
var localruRU = {}
|
||
|
var localfrFR = {}
|
||
|
var localptPT = {}
|
||
|
if (localStorage.getItem('local-enUS') != undefined) {
|
||
|
localenUS = JSON.parse(localStorage.getItem('local-enUS'));
|
||
|
}
|
||
|
if (localStorage.getItem('local-zhCN') != undefined) {
|
||
|
localzhCN = JSON.parse(localStorage.getItem('local-zhCN'));
|
||
|
}
|
||
|
if (localStorage.getItem('local-ruRU') != undefined) {
|
||
|
localruRU = JSON.parse(localStorage.getItem('local-ruRU'));
|
||
|
}
|
||
|
if (localStorage.getItem('local-frFR') != undefined) {
|
||
|
localfrFR = JSON.parse(localStorage.getItem('local-frFR'));
|
||
|
}
|
||
|
if (localStorage.getItem('local-ptPT') != undefined) {
|
||
|
localptPT = JSON.parse(localStorage.getItem('local-ptPT'));
|
||
|
}
|
||
|
import enLocale from 'element-ui/lib/locale/lang/en'
|
||
|
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
|
||
|
import ElementLocale from 'element-ui/lib/locale'
|
||
|
import ruLocale from 'element-ui/lib/locale/lang/ru-RU'
|
||
|
import frLocale from 'element-ui/lib/locale/lang/fr'
|
||
|
import ptLocale from 'element-ui/lib/locale/lang/pt'
|
||
|
const lang = localStorage.getItem('lang') || 'en-US'
|
||
|
|
||
|
Vue.use(VueI18n)
|
||
|
|
||
|
const i18n = new VueI18n({
|
||
|
locale: lang,
|
||
|
messages: {
|
||
|
// 'zh-CN': { ...zhCn, ...zhCnLocale },
|
||
|
// 'en-US': { ...enUS,...enLocale },
|
||
|
// 'zh-TC': { ...zhTC },
|
||
|
// 'ru-RU': { ...ruRU },
|
||
|
// 'fr-FR': { ...frFR },
|
||
|
'zh-CN': {
|
||
|
...localzhCN,
|
||
|
...zhLocale
|
||
|
},
|
||
|
'en-US': {
|
||
|
...localenUS,
|
||
|
...enLocale
|
||
|
},
|
||
|
'ru-RU': {
|
||
|
...localruRU,
|
||
|
...ruLocale
|
||
|
},
|
||
|
'fr-FR': {
|
||
|
...localfrFR,
|
||
|
...frLocale
|
||
|
},
|
||
|
'pt-PT': {
|
||
|
...localptPT,
|
||
|
...ptLocale
|
||
|
},
|
||
|
}
|
||
|
|
||
|
})
|
||
|
ElementLocale.i18n((key, value) => i18n.t(key, value))
|
||
|
|
||
|
export default i18n
|