From c8050807d7693bcb1abba1639a8d3e70de23977c Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 27 Oct 2025 13:19:21 +0800 Subject: [PATCH] perf: The assistant's language follows the browser's default language --- frontend/src/i18n/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/i18n/index.ts b/frontend/src/i18n/index.ts index 954ea2c3..df718e65 100644 --- a/frontend/src/i18n/index.ts +++ b/frontend/src/i18n/index.ts @@ -5,13 +5,13 @@ import koKR from './ko-KR.json' import elementEnLocale from 'element-plus-secondary/es/locale/lang/en' import elementZhLocale from 'element-plus-secondary/es/locale/lang/zh-cn' import { useCache } from '@/utils/useCache' +import { getBrowserLocale } from '@/utils/utils' const elementKoLocale = elementEnLocale const { wsCache } = useCache() const getDefaultLocale = () => { - const language = wsCache.get('user.language') - return language || 'zh-CN' + return wsCache.get('user.language') || getBrowserLocale() || 'zh-CN' } const messages = { @@ -32,7 +32,7 @@ const messages = { export const i18n = createI18n({ legacy: false, locale: getDefaultLocale(), - fallbackLocale: 'en', + fallbackLocale: 'zh-CN', globalInjection: true, messages, }) @@ -46,4 +46,4 @@ const elementLocales = { export const getElementLocale = () => { const locale = i18n.global.locale.value as keyof typeof elementLocales return elementLocales[locale] ?? elementEnLocale -} \ No newline at end of file +}