mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 08:06:19 +00:00
fix(i18n): default to Simplified Chinese and simplify login labels
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -71,6 +71,8 @@
|
||||
|
||||
应用使用 Vue I18n Composition API,语言标识为 `en`、`zh-Hans`、`zh-Hant`。资源按领域存放在 `frontend/src/i18n/locales/`,使用 `领域.功能.用途` 的语义 key,例如 `accounts.connectionTest.description`,三种语言保持相同 key 和具名参数
|
||||
|
||||
默认语言为简体中文,浏览器本地保存的有效语言选择优先;未保存选择、保存值无效或存储不可用时使用简体中文
|
||||
|
||||
业务语言包及对应 UI 文案按语言加载,首次只加载当前语言,加载成功后缓存资源。缺失消息显示为空,不回退到其他语言或显示 key;切换时语言包加载失败则保留当前语言
|
||||
|
||||
- 标签、帮助、ARIA、通知和图表显式取消息;列定义、选项和展示投影使用响应式计算,不把翻译结果存进业务数据
|
||||
|
||||
@@ -12,25 +12,6 @@ export function isLocale(value: unknown): value is Locale {
|
||||
return localeOptions.some(option => option.value === value)
|
||||
}
|
||||
|
||||
export function normalizeLocale(language: string): Locale {
|
||||
try {
|
||||
const { language: base, script, region } = new Intl.Locale(language)
|
||||
if (base === 'zh') {
|
||||
if (script === 'Hant')
|
||||
return 'zh-Hant'
|
||||
if (script === 'Hans')
|
||||
return 'zh-Hans'
|
||||
return region && ['TW', 'HK', 'MO'].includes(region)
|
||||
? 'zh-Hant'
|
||||
: 'zh-Hans'
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// 无效的浏览器语言使用应用默认语言
|
||||
}
|
||||
return 'en'
|
||||
}
|
||||
|
||||
export function readInitialLocale(): Locale {
|
||||
try {
|
||||
const saved = localStorage.getItem(storageKey)
|
||||
@@ -38,9 +19,9 @@ export function readInitialLocale(): Locale {
|
||||
return saved
|
||||
}
|
||||
catch {
|
||||
// 存储不可用时继续使用浏览器语言
|
||||
// 存储不可用时使用默认语言
|
||||
}
|
||||
return normalizeLocale(navigator.language)
|
||||
return 'zh-Hans'
|
||||
}
|
||||
|
||||
export function applyLocale(value: string): void {
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"method": "Login method",
|
||||
"title": "Console login",
|
||||
"welcome": "Welcome back",
|
||||
"username": "Admin account",
|
||||
"usernamePlaceholder": "Enter your admin account",
|
||||
"username": "Account",
|
||||
"usernamePlaceholder": "Enter your account",
|
||||
"passwordPlaceholder": "Enter your password",
|
||||
"apiKeyPlaceholder": "Enter your API key",
|
||||
"pageLabel": "Log in to Codex Proxy RS",
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
"method": "选择登录方式",
|
||||
"title": "控制台登录",
|
||||
"welcome": "「 欢迎回来,登录以开始您的数据之旅 」",
|
||||
"username": "管理员账号",
|
||||
"usernamePlaceholder": "输入会话账号",
|
||||
"username": "账号",
|
||||
"usernamePlaceholder": "输入账号",
|
||||
"passwordPlaceholder": "输入会话密钥",
|
||||
"apiKeyPlaceholder": "输入 API密钥",
|
||||
"pageLabel": "Codex Proxy RS 登录",
|
||||
"password": "密码",
|
||||
"apiKey": "API密钥",
|
||||
"adminRealm": "管理员",
|
||||
"adminRealm": "Admin",
|
||||
"keyRealm": "API密钥"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
"method": "選擇登錄方式",
|
||||
"title": "控制檯登錄",
|
||||
"welcome": "「 歡迎回來,登錄以開始您的數據之旅 」",
|
||||
"username": "管理員賬號",
|
||||
"usernamePlaceholder": "輸入會話賬號",
|
||||
"username": "賬號",
|
||||
"usernamePlaceholder": "輸入賬號",
|
||||
"passwordPlaceholder": "輸入會話密鑰",
|
||||
"apiKeyPlaceholder": "輸入 API密鑰",
|
||||
"pageLabel": "Codex Proxy RS 登錄",
|
||||
"password": "密碼",
|
||||
"apiKey": "API密鑰",
|
||||
"adminRealm": "管理員",
|
||||
"adminRealm": "Admin",
|
||||
"keyRealm": "API密鑰"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user