diff --git a/index.html b/index.html index a7959fa..16194f6 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - +
diff --git a/src/shared/i18n/index.ts b/src/shared/i18n/index.ts index 14f732b..857f5aa 100644 --- a/src/shared/i18n/index.ts +++ b/src/shared/i18n/index.ts @@ -14,8 +14,8 @@ const messages = { 'en-US': {} // 英文使用key作为默认值 } -// 全局语言状态 -export const locale = ref('zh-CN') +// 全局语言状态 - 默认英文 +export const locale = ref('en-US') // 翻译函数 - 支持 t("自然英文") 语法 export function t(key: string) { @@ -45,6 +45,9 @@ export function initLocale() { const saved = localStorage.getItem('locale') if (saved && locales.some(l => l.code === saved)) { locale.value = saved + } else { + // 如果没有保存的语言,默认使用英文 + locale.value = 'en-US' } // 初始化时设置 HTML 的 lang 属性 if (typeof document !== 'undefined') {