|
@@ -1,6 +1,7 @@
|
|
import Vue from 'vue';
|
|
import Vue from 'vue';
|
|
import VueI18n from 'vue-i18n';
|
|
import VueI18n from 'vue-i18n';
|
|
import store from '../store';
|
|
import store from '../store';
|
|
|
|
+import { getToken } from '../utils/auth';
|
|
import { getStaticContent } from '@/api/ajax';
|
|
import { getStaticContent } from '@/api/ajax';
|
|
import ElementLocale from 'element-ui/lib/locale';
|
|
import ElementLocale from 'element-ui/lib/locale';
|
|
import zhLocal from 'element-ui/lib/locale/lang/zh-CN';
|
|
import zhLocal from 'element-ui/lib/locale/lang/zh-CN';
|
|
@@ -11,8 +12,16 @@ import deLocal from 'element-ui/lib/locale/lang/de';
|
|
import ruLocal from 'element-ui/lib/locale/lang/ru-RU';
|
|
import ruLocal from 'element-ui/lib/locale/lang/ru-RU';
|
|
|
|
|
|
Vue.use(VueI18n);
|
|
Vue.use(VueI18n);
|
|
|
|
+let locale = 'ZH';
|
|
|
|
+if (getToken()) {
|
|
|
|
+ const user = JSON.parse(getToken());
|
|
|
|
+ let language_type = user.language_type;
|
|
|
|
+ locale = language_type || localStorage.getItem('language_type') || "ZH";
|
|
|
|
+} else {
|
|
|
|
+ locale = localStorage.getItem('language_type') || "ZH";
|
|
|
|
+}
|
|
const i18n = new VueI18n({
|
|
const i18n = new VueI18n({
|
|
- locale: localStorage.getItem('language_type') || 'ZH',//store.getters.language_type,
|
|
|
|
|
|
+ locale: locale,//store.getters.language_type,
|
|
messages: {
|
|
messages: {
|
|
ZH: {
|
|
ZH: {
|
|
...zhLocal
|
|
...zhLocal
|