import VueI18n from 'vue-i18n'
import ElementUI from 'element-ui'
import ElementLocale from 'element-ui/lib/locale'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import Cookies from 'js-cookie'
import lang from '@/common/lang' // 中英文翻译
Vue.use(ElementUI);
Vue.use(VueI18n);
const i18n = new VueI18n({
locale: Cookies.get('language') || 'en', // 语言标识
messages: {
en: {
...lang.en,
...enLocale
},
zh: {
...lang.zh,
...zhLocale
}
}
});
Cookies.set('language',i18n.locale);
ElementLocale.i18n((key, value) => i18n.t(key, value))