add vxe-table i18n

This commit is contained in:
Himit_ZH 2021-12-07 12:19:05 +08:00
parent 898f819c5f
commit e3a7be0382
3 changed files with 14 additions and 6 deletions

View File

@ -2,12 +2,14 @@ import Vue from 'vue'
import VueI18n from 'vue-i18n'
import elenUS from 'element-ui/lib/locale/lang/en'
import elzhCN from 'element-ui/lib/locale/lang/zh-CN'
import vxeEnUS from 'vxe-table/lib/locale/lang/en-US'
import vxeZhCN from 'vxe-table/lib/locale/lang/zh-CN'
import storage from '@/common/storage'
Vue.use(VueI18n)
const languages = [
{value: 'en-US', label: 'English', el: elenUS},
{value: 'zh-CN', label: '简体中文', el: elzhCN},
{value: 'en-US', label: 'English', el: elenUS, vxe: {...vxeEnUS}},
{value: 'zh-CN', label: '简体中文', el: elzhCN, vxe: {...vxeZhCN}},
]
const messages = {}
@ -16,7 +18,7 @@ for (let lang of languages) {
let locale = lang.value
let m = require(`./oj/${locale}`).m
Object.assign(m, require(`./admin/${locale}`).m)
let ui = Object.assign({}, lang.el)
let ui = Object.assign(lang.vxe, lang.el)
messages[locale] = Object.assign({m: m}, ui);
}

View File

@ -14,7 +14,7 @@ import Md_Katex from '@iktakahiro/markdown-it-katex'
// 注释表示使用cdn引入
// import 'xe-utils'
// import VXETable from 'vxe-table'
import VXETable from 'vxe-table'
// import 'vxe-table/lib/style.css'
import Katex from '@/common/katex'
@ -69,7 +69,11 @@ Object.keys(filters).forEach(key => { // 注册全局过滤器
})
Vue.use(VueParticles) // 粒子特效背景
Vue.use(Katex) // 数学公式渲染
// Vue.use(VXETable) // 表格组件
VXETable.setup({
// 对组件内置的提示语进行国际化翻译
i18n: (key, value) => i18n.t(key, value)
})
Vue.use(VXETable) // 表格组件
Vue.use(VueClipboard) // 剪贴板
Vue.use(highlight) // 代码高亮
Vue.use(Element,{

View File

@ -231,7 +231,9 @@
}}+</template
>{{ row.submissionInfo[problem.displayId].tryNum
}}{{
row.submissionInfo[problem.displayId].tryNum > 1
row.submissionInfo[problem.displayId].errorNum +
row.submissionInfo[problem.displayId].tryNum >
1
? ' tries'
: ' try'
}}