feat: 设置默认语言为英文

- 将默认语言从中文改为英文(en-US)
- 更新 index.html 的 lang 属性为 en-US
- 构建时和首次访问时默认显示英文版
This commit is contained in:
jingrow 2026-01-03 23:06:14 +08:00
parent f8958bd65f
commit cccc27169f
2 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="zh-CN">
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/logo.svg" sizes="any" />

View File

@ -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') {