mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-25 17:22:55 +00:00
feat: element i18n
This commit is contained in:
parent
059ffc1b01
commit
0b4ae7c7a1
|
|
@ -1,5 +1,7 @@
|
||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
declare module 'element-plus/dist/locale/zh-cn.mjs'
|
declare module 'element-plus/dist/locale/zh-cn.mjs'
|
||||||
|
declare module 'element-plus/dist/locale/en.mjs'
|
||||||
|
declare module 'element-plus/dist/locale/zh-tw.mjs'
|
||||||
declare module 'markdown-it-task-lists'
|
declare module 'markdown-it-task-lists'
|
||||||
declare module 'markdown-it-abbr'
|
declare module 'markdown-it-abbr'
|
||||||
declare module 'markdown-it-anchor'
|
declare module 'markdown-it-anchor'
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ import '@/styles/index.scss'
|
||||||
import ElementPlus from 'element-plus'
|
import ElementPlus from 'element-plus'
|
||||||
import * as ElementPlusIcons from '@element-plus/icons-vue'
|
import * as ElementPlusIcons from '@element-plus/icons-vue'
|
||||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||||
|
import enUs from 'element-plus/dist/locale/en.mjs'
|
||||||
|
import zhTW from 'element-plus/dist/locale/zh-tw.mjs'
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import { store } from '@/stores'
|
import { store } from '@/stores'
|
||||||
import directives from '@/directives'
|
import directives from '@/directives'
|
||||||
|
|
@ -10,7 +12,6 @@ import router from '@/router'
|
||||||
import Components from '@/components'
|
import Components from '@/components'
|
||||||
import i18n from './locales'
|
import i18n from './locales'
|
||||||
import { config } from 'md-editor-v3'
|
import { config } from 'md-editor-v3'
|
||||||
|
|
||||||
import screenfull from 'screenfull'
|
import screenfull from 'screenfull'
|
||||||
|
|
||||||
import katex from 'katex'
|
import katex from 'katex'
|
||||||
|
|
@ -51,8 +52,13 @@ app.use(directives)
|
||||||
for (const [key, component] of Object.entries(ElementPlusIcons)) {
|
for (const [key, component] of Object.entries(ElementPlusIcons)) {
|
||||||
app.component(key, component)
|
app.component(key, component)
|
||||||
}
|
}
|
||||||
|
const locale_map: any = {
|
||||||
|
'zh-CN': zhCn,
|
||||||
|
'zh-Hant': zhTW,
|
||||||
|
'en-US': enUs
|
||||||
|
}
|
||||||
app.use(ElementPlus, {
|
app.use(ElementPlus, {
|
||||||
locale: zhCn
|
locale: locale_map[localStorage.getItem('MaxKB-locale') || 'zh-CN']
|
||||||
})
|
})
|
||||||
|
|
||||||
app.use(router)
|
app.use(router)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue