From 9190eb55eb4bfc9d745837257ad3e276ad3cfe5f Mon Sep 17 00:00:00 2001 From: wanghe-fit2cloud Date: Tue, 24 Mar 2026 18:04:29 +0800 Subject: [PATCH] fix: sync fit2cloud table locale on first load --- frontend/src/App.vue | 2 +- frontend/src/main.ts | 5 +++-- frontend/src/store/modules/global.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 6876dc8a4b3c..7abba6f42bde 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -32,7 +32,7 @@ const i18nLocale = computed(() => { if (globalStore.language === 'ja') return ja; if (globalStore.language === 'ms') return ms; if (globalStore.language === 'ru') return ru; - if (globalStore.language === 'pt-br') return ptBR; + if (globalStore.language === 'pt-BR') return ptBR; if (globalStore.language === 'ko') return ko; if (globalStore.language === 'tr') return tr; if (globalStore.language === 'es-ES') return esES; diff --git a/frontend/src/main.ts b/frontend/src/main.ts index baf5916d8cd1..20b08056a4a1 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -1,4 +1,4 @@ -import { createApp } from 'vue'; +import { computed, createApp } from 'vue'; import App from './App.vue'; import '@/styles/index.scss'; @@ -30,9 +30,10 @@ const bootstrap = async () => { await Promise.all([loadLocaleMessages(currentLocale), ensureFallbackLocale()]); const app = createApp(App); + const fit2cloudLocale = computed(() => i18n.global.getLocaleMessage(i18n.global.locale.value)); app.component('SvgIcon', SvgIcon); app.use(ElementPlus); - app.use(Fit2CloudPlus, { locale: i18n.global.getLocaleMessage(currentLocale) }); + app.use(Fit2CloudPlus, { locale: fit2cloudLocale }); Object.keys(Icons).forEach((key) => { app.component(key, Icons[key as keyof typeof Icons]); diff --git a/frontend/src/store/modules/global.ts b/frontend/src/store/modules/global.ts index b2223e2232b4..cccbd1dc7917 100644 --- a/frontend/src/store/modules/global.ts +++ b/frontend/src/store/modules/global.ts @@ -14,7 +14,7 @@ const GlobalStore = defineStore({ loadingText: '', isLogin: false, entrance: '', - language: '', + language: i18n.global.locale.value, themeConfig: { panelName: '', primary: '#005eeb',