diff --git a/ui/env.d.ts b/ui/env.d.ts index be1f8389d..08bb5e826 100644 --- a/ui/env.d.ts +++ b/ui/env.d.ts @@ -1,5 +1,7 @@ /// 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-abbr' declare module 'markdown-it-anchor' diff --git a/ui/src/main.ts b/ui/src/main.ts index a93fe9ea9..69e220b78 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -2,6 +2,8 @@ import '@/styles/index.scss' import ElementPlus from 'element-plus' import * as ElementPlusIcons from '@element-plus/icons-vue' 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 { store } from '@/stores' import directives from '@/directives' @@ -10,7 +12,6 @@ import router from '@/router' import Components from '@/components' import i18n from './locales' import { config } from 'md-editor-v3' - import screenfull from 'screenfull' import katex from 'katex' @@ -51,8 +52,13 @@ app.use(directives) for (const [key, component] of Object.entries(ElementPlusIcons)) { app.component(key, component) } +const locale_map: any = { + 'zh-CN': zhCn, + 'zh-Hant': zhTW, + 'en-US': enUs +} app.use(ElementPlus, { - locale: zhCn + locale: locale_map[localStorage.getItem('MaxKB-locale') || 'zh-CN'] }) app.use(router)