diff --git a/package-lock.json b/package-lock.json index 7384fa9..f56e3c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10861,9 +10861,9 @@ "integrity": "sha512-fUQhIVVfp2crf2wanLCpDLWp5Mao/i9lTQeS9Mj46/IOF+FuAKKyJ/ULk6+OlH0Ro6VEVGzlr/bQFArJdCfKsQ==", "requires": { "marked": "^0.3.19", - "simple-hotkeys": "github:itargaryen/simple-hotkeys", - "simple-module": "github:itargaryen/simple-module#v2.1.0", - "simple-uploader": "github:itargaryen/simple-uploader#v2.1.0", + "simple-hotkeys": "github:itargaryen/simple-hotkeys#8a6b2cf19d06100ac86d7ce4d442df08c561b7e9", + "simple-module": "github:itargaryen/simple-module#ea2688c579170eca533cd0bd8ba7f83c8d241a1c", + "simple-uploader": "github:itargaryen/simple-uploader#79d795ca1ce0b163c0e335fddad5bf9393004780", "to-markdown": "^3.1.1" }, "dependencies": { @@ -10888,7 +10888,7 @@ "from": "github:itargaryen/simple-uploader#v2.1.0", "requires": { "jquery": "=3.1.1", - "simple-module": "github:itargaryen/simple-module#v2.1.0" + "simple-module": "github:itargaryen/simple-module#ea2688c579170eca533cd0bd8ba7f83c8d241a1c" } } } diff --git a/src/i18n/index.js b/src/i18n/index.js index 641c246..154b05e 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -1,12 +1,20 @@ import Vue from 'vue' import VueI18n from 'vue-i18n' +// ivew UI +import ivenUS from 'iview/dist/locale/en-US' +import ivzhCN from 'iview/dist/locale/zh-CN' +import ivzhTW from 'iview/dist/locale/zh-TW' +// element UI +import elenUS from 'element-ui/lib/locale/lang/en' +import elzhCN from 'element-ui/lib/locale/lang/zh-CN' +import elzhTW from 'element-ui/lib/locale/lang/zh-TW' Vue.use(VueI18n) const languages = [ - {value: 'en-US', label: 'English'}, - {value: 'zh-CN', label: '简体中文'}, - {value: 'zh-TW', label: '繁體中文'} + {value: 'en-US', label: 'English', iv: ivenUS, el: elenUS}, + {value: 'zh-CN', label: '简体中文', iv: ivzhCN, el: elzhCN}, + {value: 'zh-TW', label: '繁體中文', iv: ivzhTW, el: elzhTW} ] const messages = {} @@ -15,7 +23,8 @@ for (let lang of languages) { let locale = lang.value let m = require(`./oj/${locale}`).m Object.assign(m, require(`./admin/${locale}`).m) - messages[locale] = {m: m} + let ui = Object.assign(lang.iv, lang.el) + messages[locale] = Object.assign({m: m}, ui) } // load language packages export default new VueI18n({ diff --git a/src/pages/admin/index.js b/src/pages/admin/index.js index 33cd747..1aac8d0 100644 --- a/src/pages/admin/index.js +++ b/src/pages/admin/index.js @@ -5,7 +5,6 @@ import store from '@/store' import i18n from '@/i18n' import Element from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' -import locale from 'element-ui/lib/locale/lang/en' import filters from '@/utils/filters' import router from './router' @@ -28,7 +27,6 @@ Vue.use(VueAnalytics, { id: GOOGLE_ANALYTICS_ID, router }) -Vue.use(Element, {locale}) Vue.use(katex) Vue.component(IconBtn.name, IconBtn) Vue.component(Panel.name, Panel) diff --git a/src/pages/oj/index.js b/src/pages/oj/index.js index 1537b16..70be962 100644 --- a/src/pages/oj/index.js +++ b/src/pages/oj/index.js @@ -9,7 +9,6 @@ import VueAnalytics from 'vue-analytics' import { GOOGLE_ANALYTICS_ID } from '@/utils/constants' import iView from 'iview' -import locale from 'iview/dist/locale/en-US' import 'iview/dist/styles/iview.css' import Panel from '@oj/components/Panel.vue' @@ -39,7 +38,9 @@ Object.keys(filters).forEach(key => { }) Vue.config.productionTip = false -Vue.use(iView, {locale}) +Vue.use(iView, { + i18n: (key, value) => i18n.t(key, value) +}) Vue.use(VueClipboard) Vue.use(highlight)