diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 6060971d9..a6c7b18ef 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -23,8 +23,6 @@ const i18nLocale = computed((): any => { return ''; }); -// const assemblySize = computed((): string => globalStore.assemblySize); - let isRouterAlive = ref(true); const reload = () => { diff --git a/frontend/src/lang/index.ts b/frontend/src/lang/index.ts index 4603ef6ba..d4a3cdaa3 100644 --- a/frontend/src/lang/index.ts +++ b/frontend/src/lang/index.ts @@ -4,7 +4,7 @@ import en from './modules/en'; const i18n = createI18n({ legacy: false, - locale: 'zh', + locale: localStorage.getItem('lang') || 'zh', globalInjection: true, messages: { zh, diff --git a/frontend/src/store/index.ts b/frontend/src/store/index.ts index db133abdb..d4d480d36 100644 --- a/frontend/src/store/index.ts +++ b/frontend/src/store/index.ts @@ -40,6 +40,7 @@ export const GlobalStore = defineStore({ }, updateLanguage(language: any) { this.language = language; + localStorage.setItem('lang', language); }, setThemeConfig(themeConfig: ThemeConfigProp) { this.themeConfig = themeConfig; diff --git a/frontend/src/views/website/website/index.vue b/frontend/src/views/website/website/index.vue index d485b8d30..a1281b55d 100644 --- a/frontend/src/views/website/website/index.vue +++ b/frontend/src/views/website/website/index.vue @@ -166,10 +166,11 @@ import { App } from '@/api/interface/app'; import { ElMessageBox } from 'element-plus'; import { dateFormatSimple } from '@/utils/util'; import { MsgSuccess } from '@/utils/message'; +import { useI18n } from 'vue-i18n'; const shortcuts = [ { - text: i18n.global.t('website.ever'), + text: useI18n().t('website.ever'), value: () => { return new Date('1970-01-01'); },