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 +}