扩充多语言范围,新增7种多语言

This commit is contained in:
xintaofei
2026-03-09 15:31:34 +08:00
parent 32fbafa1fe
commit 08b33b5755
18 changed files with 9457 additions and 75 deletions

View File

@@ -9,7 +9,18 @@ const withNextIntl = createNextIntlPlugin({
messages: { messages: {
path: "./src/i18n/messages", path: "./src/i18n/messages",
format: "json", format: "json",
locales: ["en", "zh-CN", "zh-TW"], locales: [
"en",
"zh-CN",
"zh-TW",
"ja",
"ko",
"es",
"de",
"fr",
"pt",
"ar",
],
precompile: true, precompile: true,
}, },
}, },

View File

@@ -13,6 +13,13 @@ pub enum AppLocale {
En, En,
ZhCn, ZhCn,
ZhTw, ZhTw,
Ja,
Ko,
Es,
De,
Fr,
Pt,
Ar,
} }
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)] #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)]

View File

@@ -239,6 +239,7 @@ export function AppI18nProvider({
useEffect(() => { useEffect(() => {
document.documentElement.lang = activeIntlLocale document.documentElement.lang = activeIntlLocale
document.documentElement.dir = activeIntlLocale === "ar" ? "rtl" : "ltr"
}, [activeIntlLocale]) }, [activeIntlLocale])
const contextValue = useMemo<AppI18nContextValue>( const contextValue = useMemo<AppI18nContextValue>(

View File

@@ -36,9 +36,10 @@ import {
normalizeAppUpdateError, normalizeAppUpdateError,
relaunchApp, relaunchApp,
} from "@/lib/updater" } from "@/lib/updater"
import { APP_LOCALES } from "@/lib/i18n"
const PROXY_EXAMPLE = "http://127.0.0.1:7890" const PROXY_EXAMPLE = "http://127.0.0.1:7890"
const APP_LANGUAGE_VALUES = ["en", "zh_cn", "zh_tw"] as const const APP_LANGUAGE_VALUES = APP_LOCALES
type LanguageSelectValue = "system" | AppLocale type LanguageSelectValue = "system" | AppLocale
@@ -83,6 +84,13 @@ export function SystemNetworkSettings() {
en: tLanguage("english"), en: tLanguage("english"),
zh_cn: tLanguage("simplifiedChinese"), zh_cn: tLanguage("simplifiedChinese"),
zh_tw: tLanguage("traditionalChinese"), zh_tw: tLanguage("traditionalChinese"),
ja: tLanguage("japanese"),
ko: tLanguage("korean"),
es: tLanguage("spanish"),
de: tLanguage("german"),
fr: tLanguage("french"),
pt: tLanguage("portuguese"),
ar: tLanguage("arabic"),
}), }),
[tLanguage] [tLanguage]
) )
@@ -362,6 +370,13 @@ export function SystemNetworkSettings() {
<SelectItem value="en">{languageLabels.en}</SelectItem> <SelectItem value="en">{languageLabels.en}</SelectItem>
<SelectItem value="zh_cn">{languageLabels.zh_cn}</SelectItem> <SelectItem value="zh_cn">{languageLabels.zh_cn}</SelectItem>
<SelectItem value="zh_tw">{languageLabels.zh_tw}</SelectItem> <SelectItem value="zh_tw">{languageLabels.zh_tw}</SelectItem>
<SelectItem value="ja">{languageLabels.ja}</SelectItem>
<SelectItem value="ko">{languageLabels.ko}</SelectItem>
<SelectItem value="es">{languageLabels.es}</SelectItem>
<SelectItem value="de">{languageLabels.de}</SelectItem>
<SelectItem value="fr">{languageLabels.fr}</SelectItem>
<SelectItem value="pt">{languageLabels.pt}</SelectItem>
<SelectItem value="ar">{languageLabels.ar}</SelectItem>
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>

12
src/i18n/global.d.ts vendored
View File

@@ -2,7 +2,17 @@ import type enMessages from "@/i18n/messages/en.json"
declare module "next-intl" { declare module "next-intl" {
interface AppConfig { interface AppConfig {
Locale: "en" | "zh-CN" | "zh-TW" Locale:
| "en"
| "zh-CN"
| "zh-TW"
| "ja"
| "ko"
| "es"
| "de"
| "fr"
| "pt"
| "ar"
Messages: typeof enMessages Messages: typeof enMessages
} }
} }

View File

@@ -12,6 +12,20 @@ async function loadMessages(locale: AppLocale): Promise<AbstractIntlMessages> {
return (await import("@/i18n/messages/zh-CN.json")).default return (await import("@/i18n/messages/zh-CN.json")).default
case "zh_tw": case "zh_tw":
return (await import("@/i18n/messages/zh-TW.json")).default return (await import("@/i18n/messages/zh-TW.json")).default
case "ja":
return (await import("@/i18n/messages/ja.json")).default
case "ko":
return (await import("@/i18n/messages/ko.json")).default
case "es":
return (await import("@/i18n/messages/es.json")).default
case "de":
return (await import("@/i18n/messages/de.json")).default
case "fr":
return (await import("@/i18n/messages/fr.json")).default
case "pt":
return (await import("@/i18n/messages/pt.json")).default
case "ar":
return (await import("@/i18n/messages/ar.json")).default
case "en": case "en":
default: default:
return enMessages return enMessages

1320
src/i18n/messages/ar.json Normal file

File diff suppressed because it is too large Load Diff

1320
src/i18n/messages/de.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,14 @@
"followSystem": "Follow System", "followSystem": "Follow System",
"english": "English", "english": "English",
"simplifiedChinese": "Simplified Chinese", "simplifiedChinese": "Simplified Chinese",
"traditionalChinese": "Traditional Chinese" "traditionalChinese": "Traditional Chinese",
"japanese": "Japanese",
"korean": "Korean",
"spanish": "Spanish",
"german": "German",
"french": "French",
"portuguese": "Portuguese",
"arabic": "Arabic"
}, },
"WelcomePage": { "WelcomePage": {
"title": "Welcome to Codeg", "title": "Welcome to Codeg",

1320
src/i18n/messages/es.json Normal file

File diff suppressed because it is too large Load Diff

1320
src/i18n/messages/fr.json Normal file

File diff suppressed because it is too large Load Diff

1320
src/i18n/messages/ja.json Normal file

File diff suppressed because it is too large Load Diff

1320
src/i18n/messages/ko.json Normal file

File diff suppressed because it is too large Load Diff

1320
src/i18n/messages/pt.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,16 @@
{ {
"Language": { "Language": {
"followSystem": "跟随系统", "followSystem": "跟随系统",
"english": "English", "english": "英语",
"simplifiedChinese": "简体中文", "simplifiedChinese": "简体中文",
"traditionalChinese": "繁體中文" "traditionalChinese": "繁體中文",
"japanese": "日语",
"korean": "韩语",
"spanish": "西班牙语",
"german": "德语",
"french": "法语",
"portuguese": "葡萄牙语",
"arabic": "阿拉伯语"
}, },
"WelcomePage": { "WelcomePage": {
"title": "欢迎使用Codeg", "title": "欢迎使用Codeg",
@@ -74,7 +81,7 @@
"resolvedTheme": { "resolvedTheme": {
"light": "浅色", "light": "浅色",
"dark": "深色", "dark": "深色",
"unknown": "--" "unknown": "未知"
} }
}, },
"SystemSettings": { "SystemSettings": {
@@ -193,7 +200,7 @@
"emptySkills": "暂无 Skill可点击“新建 Skill”。", "emptySkills": "暂无 Skill可点击“新建 Skill”。",
"newSkillTitle": "新建 Skill", "newSkillTitle": "新建 Skill",
"skillInfo": "Skill 信息", "skillInfo": "Skill 信息",
"skillIdPlaceholder": "skill-id (letters/numbers/-/_/.)", "skillIdPlaceholder": "Skill ID例如my-skill",
"skillsDirectoryWithPath": "Skills目录{path}", "skillsDirectoryWithPath": "Skills目录{path}",
"skillsDirectoryNeedId": "Skills目录请输入 Skill ID 以生成完整路径", "skillsDirectoryNeedId": "Skills目录请输入 Skill ID 以生成完整路径",
"markdownContent": "Markdown 内容", "markdownContent": "Markdown 内容",
@@ -318,20 +325,20 @@
"empty": "暂无 MCP 结果。", "empty": "暂无 MCP 结果。",
"loadingDetail": "加载市场详情...", "loadingDetail": "加载市场详情...",
"detailLoadFailed": "加载详情失败:{message}", "detailLoadFailed": "加载详情失败:{message}",
"owner": "Owner: {owner}", "owner": "所有者:{owner}",
"namespace": "Namespace: {namespace}", "namespace": "命名空间:{namespace}",
"defaultInstallProtocol": "默认安装协议", "defaultInstallProtocol": "默认安装协议",
"currentOptionParameterCount": "当前选项参数数:{count}", "currentOptionParameterCount": "当前选项参数数:{count}",
"installConfigDescription": "安装配置(JSON可修改后安装修改后将覆盖协议/参数表单)", "installConfigDescription": "安装配置(JSON可修改后安装修改后将覆盖协议/参数表单)",
"selectLeftToView": "请选择左侧市场 MCP 查看详情。" "selectLeftToView": "请选择左侧市场 MCP 查看详情。"
}, },
"badges": { "badges": {
"verified": "Verified", "verified": "已验证",
"remote": "Remote", "remote": "远程",
"hasHomepage": "Has Homepage", "hasHomepage": "有主页",
"uses": "{count} uses", "uses": "{count} 次使用",
"deployed": "Deployed", "deployed": "已部署",
"notDeployed": "Not Deployed" "notDeployed": "未部署"
}, },
"selectLeftMcp": "请选择左侧 MCP。" "selectLeftMcp": "请选择左侧 MCP。"
}, },
@@ -625,8 +632,8 @@
"prompting": "响应中...", "prompting": "响应中...",
"error": "连接异常", "error": "连接异常",
"disconnected": "未连接", "disconnected": "未连接",
"tooltip": "{agent} - {status}", "tooltip": "{agent}{status}",
"tooltipError": "{agent} - {error}" "tooltipError": "{agent}{error}"
}, },
"tasks": { "tasks": {
"title": "任务" "title": "任务"
@@ -653,10 +660,10 @@
}, },
"auxPanel": { "auxPanel": {
"tabs": { "tabs": {
"diff": "Diff", "diff": "差异",
"files": "Files", "files": "文件",
"changes": "Changes", "changes": "变更",
"commits": "Commits" "commits": "提交"
} }
}, },
"windowControls": { "windowControls": {
@@ -712,7 +719,7 @@
"fileCount": "{count} 个文件", "fileCount": "{count} 个文件",
"openFileOrDiff": "从右侧面板打开文件或差异", "openFileOrDiff": "从右侧面板打开文件或差异",
"disk": "磁盘", "disk": "磁盘",
"head": "HEAD", "head": "HEAD(当前提交)",
"unsaved": "未保存", "unsaved": "未保存",
"workingTree": "工作区", "workingTree": "工作区",
"loading": "加载中...", "loading": "加载中...",
@@ -817,7 +824,7 @@
"addToVcs": "添加到 VCS" "addToVcs": "添加到 VCS"
}, },
"aria": { "aria": {
"selectFile": "{action} {path}", "selectFile": "{action}{path}",
"unselectAllFiles": "取消选择全部文件", "unselectAllFiles": "取消选择全部文件",
"selectAllFiles": "选择全部文件", "selectAllFiles": "选择全部文件",
"unselectTracked": "取消选择已跟踪改动", "unselectTracked": "取消选择已跟踪改动",
@@ -833,13 +840,13 @@
"commitMessage": "提交消息", "commitMessage": "提交消息",
"commitMessagePlaceholder": "输入提交信息...", "commitMessagePlaceholder": "输入提交信息...",
"commitButton": "提交 ({count})", "commitButton": "提交 ({count})",
"head": "HEAD", "head": "HEAD(当前提交)",
"workingTree": "Working Tree", "workingTree": "工作区",
"clickFileToDiff": "点击文件名查看差异", "clickFileToDiff": "点击文件名查看差异",
"loadingDiff": "加载差异..." "loadingDiff": "加载差异..."
}, },
"gitLogTab": { "gitLogTab": {
"filesTitle": "Files", "filesTitle": "文件",
"expandAllFiles": "展开全部文件", "expandAllFiles": "展开全部文件",
"collapseAllFiles": "折叠全部文件", "collapseAllFiles": "折叠全部文件",
"workspace": "工作区", "workspace": "工作区",
@@ -953,7 +960,7 @@
"addToVcs": "添加到 VCS" "addToVcs": "添加到 VCS"
}, },
"aria": { "aria": {
"selectPath": "{action} {path}" "selectPath": "{action}{path}"
}, },
"toasts": { "toasts": {
"openDirectoryFailed": "打开目录失败", "openDirectoryFailed": "打开目录失败",
@@ -978,8 +985,8 @@
"renameDirectory": "重命名目录", "renameDirectory": "重命名目录",
"renameFile": "重命名文件", "renameFile": "重命名文件",
"description": "输入新的名称(仅名称,不含路径)。", "description": "输入新的名称(仅名称,不含路径)。",
"placeholderDirectory": "new-folder-name", "placeholderDirectory": "新建文件夹名称",
"placeholderFile": "new-file-name.ext" "placeholderFile": "新建文件名称.ext"
}, },
"directoryDialog": { "directoryDialog": {
"descriptionAdd": "选择目录 {path} 下要添加到 VCS 的文件。", "descriptionAdd": "选择目录 {path} 下要添加到 VCS 的文件。",
@@ -1059,13 +1066,13 @@
"noDiffOutput": "无差异输出。", "noDiffOutput": "无差异输出。",
"diffTitleWorkspace": "Diff · 工作区", "diffTitleWorkspace": "Diff · 工作区",
"diffDescriptionWorkingTree": "工作区变更HEAD", "diffDescriptionWorkingTree": "工作区变更HEAD",
"diffTitleFile": "Diff · {name}", "diffTitleFile": "差异 · {name}",
"compareTitleFile": "比较 · {name}", "compareTitleFile": "比较 · {name}",
"compareTitleBranch": "比较 · {branch}", "compareTitleBranch": "比较 · {branch}",
"compareDescriptionPath": "{path} · 与 {branch} 比较", "compareDescriptionPath": "{path} · 与 {branch} 比较",
"compareDescriptionBranch": "与 {branch} 比较", "compareDescriptionBranch": "与 {branch} 比较",
"diffTitleCommitFile": "Diff · {name} @ {hash}", "diffTitleCommitFile": "差异 · {name} @ {hash}",
"diffTitleCommit": "Diff · {hash}", "diffTitleCommit": "差异 · {hash}",
"diffDescriptionCommitPath": "{path} · 提交 {commit}", "diffDescriptionCommitPath": "{path} · 提交 {commit}",
"diffDescriptionCommit": "提交 {commit}", "diffDescriptionCommit": "提交 {commit}",
"diffTitleConflictFile": "冲突 · {name}", "diffTitleConflictFile": "冲突 · {name}",
@@ -1078,7 +1085,7 @@
"retry": "重试" "retry": "重试"
}, },
"agentsSetupHint": "点击前往设置 > Agents 管理安装。", "agentsSetupHint": "点击前往设置 > Agents 管理安装。",
"withSetupHint": "{message}\n{hint}", "withSetupHint": "{message}\n提示:{hint}",
"blocked": { "blocked": {
"missingConfig": "无法读取当前 Agent 配置。", "missingConfig": "无法读取当前 Agent 配置。",
"disabled": "{agent} 已在 Agents 管理中禁用,请先启用后再连接。", "disabled": "{agent} 已在 Agents 管理中禁用,请先启用后再连接。",
@@ -1195,7 +1202,7 @@
"streaming": "生成中", "streaming": "生成中",
"elapsedMinutes": "{value} 分钟", "elapsedMinutes": "{value} 分钟",
"elapsedSeconds": "{value} 秒", "elapsedSeconds": "{value} 秒",
"toolUseCount": "{count} 工具调用" "toolUseCount": "{count} 工具 {count, plural, one {use} other {uses}}"
}, },
"tool": { "tool": {
"parameters": "参数", "parameters": "参数",
@@ -1243,14 +1250,14 @@
"nameLabel": "名称:", "nameLabel": "名称:",
"field": { "field": {
"file": "文件", "file": "文件",
"notebook": "Notebook", "notebook": "笔记本",
"command": "命令", "command": "命令",
"old": "旧内容", "old": "旧内容",
"new": "新内容", "new": "新内容",
"pattern": "模式", "pattern": "模式",
"path": "路径", "path": "路径",
"query": "查询", "query": "查询",
"url": "URL", "url": "URL地址",
"description": "描述", "description": "描述",
"content": "内容", "content": "内容",
"source": "源内容", "source": "源内容",

View File

@@ -1,9 +1,16 @@
{ {
"Language": { "Language": {
"followSystem": "跟隨系統", "followSystem": "跟隨系統",
"english": "English", "english": "英文",
"simplifiedChinese": "简体中文", "simplifiedChinese": "簡體中文",
"traditionalChinese": "繁體中文" "traditionalChinese": "繁體中文",
"japanese": "日語",
"korean": "韓語",
"spanish": "西班牙語",
"german": "德語",
"french": "法語",
"portuguese": "葡萄牙語",
"arabic": "阿拉伯語"
}, },
"WelcomePage": { "WelcomePage": {
"title": "歡迎使用Codeg", "title": "歡迎使用Codeg",
@@ -74,7 +81,7 @@
"resolvedTheme": { "resolvedTheme": {
"light": "淺色", "light": "淺色",
"dark": "深色", "dark": "深色",
"unknown": "--" "unknown": "未知"
} }
}, },
"SystemSettings": { "SystemSettings": {
@@ -193,7 +200,7 @@
"emptySkills": "暫無 Skill可點擊「新增 Skill」。", "emptySkills": "暫無 Skill可點擊「新增 Skill」。",
"newSkillTitle": "新增 Skill", "newSkillTitle": "新增 Skill",
"skillInfo": "Skill 資訊", "skillInfo": "Skill 資訊",
"skillIdPlaceholder": "skill-id (letters/numbers/-/_/.)", "skillIdPlaceholder": "Skill ID例如my-skill",
"skillsDirectoryWithPath": "Skills目錄{path}", "skillsDirectoryWithPath": "Skills目錄{path}",
"skillsDirectoryNeedId": "Skills目錄請輸入 Skill ID 以產生完整路徑", "skillsDirectoryNeedId": "Skills目錄請輸入 Skill ID 以產生完整路徑",
"markdownContent": "Markdown 內容", "markdownContent": "Markdown 內容",
@@ -318,20 +325,20 @@
"empty": "暫無 MCP 結果。", "empty": "暫無 MCP 結果。",
"loadingDetail": "載入市場詳情...", "loadingDetail": "載入市場詳情...",
"detailLoadFailed": "載入詳情失敗:{message}", "detailLoadFailed": "載入詳情失敗:{message}",
"owner": "Owner: {owner}", "owner": "擁有者:{owner}",
"namespace": "Namespace: {namespace}", "namespace": "命名空間:{namespace}",
"defaultInstallProtocol": "預設安裝協議", "defaultInstallProtocol": "預設安裝協議",
"currentOptionParameterCount": "目前選項參數數:{count}", "currentOptionParameterCount": "目前選項參數數:{count}",
"installConfigDescription": "安裝配置(JSON可修改後安裝修改後將覆蓋協議/參數表單)", "installConfigDescription": "安裝配置(JSON可修改後安裝修改後將覆蓋協議/參數表單)",
"selectLeftToView": "請選擇左側市場 MCP 查看詳情。" "selectLeftToView": "請選擇左側市場 MCP 查看詳情。"
}, },
"badges": { "badges": {
"verified": "Verified", "verified": "已驗證",
"remote": "Remote", "remote": "遠端",
"hasHomepage": "Has Homepage", "hasHomepage": "有首頁",
"uses": "{count} uses", "uses": "{count} 次使用",
"deployed": "Deployed", "deployed": "已部署",
"notDeployed": "Not Deployed" "notDeployed": "未部署"
}, },
"selectLeftMcp": "請選擇左側 MCP。" "selectLeftMcp": "請選擇左側 MCP。"
}, },
@@ -625,8 +632,8 @@
"prompting": "回應中...", "prompting": "回應中...",
"error": "連線異常", "error": "連線異常",
"disconnected": "未連線", "disconnected": "未連線",
"tooltip": "{agent} - {status}", "tooltip": "{agent}{status}",
"tooltipError": "{agent} - {error}" "tooltipError": "{agent}{error}"
}, },
"tasks": { "tasks": {
"title": "任務" "title": "任務"
@@ -653,10 +660,10 @@
}, },
"auxPanel": { "auxPanel": {
"tabs": { "tabs": {
"diff": "Diff", "diff": "差異",
"files": "Files", "files": "檔案",
"changes": "Changes", "changes": "變更",
"commits": "Commits" "commits": "提交"
} }
}, },
"windowControls": { "windowControls": {
@@ -712,7 +719,7 @@
"fileCount": "{count} 個檔案", "fileCount": "{count} 個檔案",
"openFileOrDiff": "從右側面板打開檔案或差異", "openFileOrDiff": "從右側面板打開檔案或差異",
"disk": "磁碟", "disk": "磁碟",
"head": "HEAD", "head": "HEAD(目前提交)",
"unsaved": "未儲存", "unsaved": "未儲存",
"workingTree": "工作區", "workingTree": "工作區",
"loading": "載入中...", "loading": "載入中...",
@@ -817,7 +824,7 @@
"addToVcs": "加入到 VCS" "addToVcs": "加入到 VCS"
}, },
"aria": { "aria": {
"selectFile": "{action} {path}", "selectFile": "{action}{path}",
"unselectAllFiles": "取消選擇全部檔案", "unselectAllFiles": "取消選擇全部檔案",
"selectAllFiles": "選擇全部檔案", "selectAllFiles": "選擇全部檔案",
"unselectTracked": "取消選擇已追蹤變更", "unselectTracked": "取消選擇已追蹤變更",
@@ -833,13 +840,13 @@
"commitMessage": "提交訊息", "commitMessage": "提交訊息",
"commitMessagePlaceholder": "輸入提交訊息...", "commitMessagePlaceholder": "輸入提交訊息...",
"commitButton": "提交 ({count})", "commitButton": "提交 ({count})",
"head": "HEAD", "head": "HEAD(目前提交)",
"workingTree": "Working Tree", "workingTree": "工作目錄",
"clickFileToDiff": "點擊檔案名稱查看差異", "clickFileToDiff": "點擊檔案名稱查看差異",
"loadingDiff": "載入差異中..." "loadingDiff": "載入差異中..."
}, },
"gitLogTab": { "gitLogTab": {
"filesTitle": "Files", "filesTitle": "檔案",
"expandAllFiles": "展開全部檔案", "expandAllFiles": "展開全部檔案",
"collapseAllFiles": "折疊全部檔案", "collapseAllFiles": "折疊全部檔案",
"workspace": "工作區", "workspace": "工作區",
@@ -953,7 +960,7 @@
"addToVcs": "加入到 VCS" "addToVcs": "加入到 VCS"
}, },
"aria": { "aria": {
"selectPath": "{action} {path}" "selectPath": "{action}{path}"
}, },
"toasts": { "toasts": {
"openDirectoryFailed": "開啟目錄失敗", "openDirectoryFailed": "開啟目錄失敗",
@@ -978,8 +985,8 @@
"renameDirectory": "重新命名目錄", "renameDirectory": "重新命名目錄",
"renameFile": "重新命名檔案", "renameFile": "重新命名檔案",
"description": "輸入新的名稱(僅名稱,不含路徑)。", "description": "輸入新的名稱(僅名稱,不含路徑)。",
"placeholderDirectory": "new-folder-name", "placeholderDirectory": "新資料夾名稱",
"placeholderFile": "new-file-name.ext" "placeholderFile": "新檔案名稱.ext"
}, },
"directoryDialog": { "directoryDialog": {
"descriptionAdd": "選擇目錄 {path} 下要加入到 VCS 的檔案。", "descriptionAdd": "選擇目錄 {path} 下要加入到 VCS 的檔案。",
@@ -1059,13 +1066,13 @@
"noDiffOutput": "無差異輸出。", "noDiffOutput": "無差異輸出。",
"diffTitleWorkspace": "Diff · 工作區", "diffTitleWorkspace": "Diff · 工作區",
"diffDescriptionWorkingTree": "工作區變更HEAD", "diffDescriptionWorkingTree": "工作區變更HEAD",
"diffTitleFile": "Diff · {name}", "diffTitleFile": "差異 · {name}",
"compareTitleFile": "比較 · {name}", "compareTitleFile": "比較 · {name}",
"compareTitleBranch": "比較 · {branch}", "compareTitleBranch": "比較 · {branch}",
"compareDescriptionPath": "{path} · 與 {branch} 比較", "compareDescriptionPath": "{path} · 與 {branch} 比較",
"compareDescriptionBranch": "與 {branch} 比較", "compareDescriptionBranch": "與 {branch} 比較",
"diffTitleCommitFile": "Diff · {name} @ {hash}", "diffTitleCommitFile": "差異 · {name} @ {hash}",
"diffTitleCommit": "Diff · {hash}", "diffTitleCommit": "差異 · {hash}",
"diffDescriptionCommitPath": "{path} · 提交 {commit}", "diffDescriptionCommitPath": "{path} · 提交 {commit}",
"diffDescriptionCommit": "提交 {commit}", "diffDescriptionCommit": "提交 {commit}",
"diffTitleConflictFile": "衝突 · {name}", "diffTitleConflictFile": "衝突 · {name}",
@@ -1078,7 +1085,7 @@
"retry": "重試" "retry": "重試"
}, },
"agentsSetupHint": "點擊前往設定 > Agents 管理安裝。", "agentsSetupHint": "點擊前往設定 > Agents 管理安裝。",
"withSetupHint": "{message}\n{hint}", "withSetupHint": "{message}\n提示:{hint}",
"blocked": { "blocked": {
"missingConfig": "無法讀取目前 Agent 設定。", "missingConfig": "無法讀取目前 Agent 設定。",
"disabled": "{agent} 已在 Agents 管理中停用,請先啟用後再連線。", "disabled": "{agent} 已在 Agents 管理中停用,請先啟用後再連線。",
@@ -1195,7 +1202,7 @@
"streaming": "生成中", "streaming": "生成中",
"elapsedMinutes": "{value} 分鐘", "elapsedMinutes": "{value} 分鐘",
"elapsedSeconds": "{value} 秒", "elapsedSeconds": "{value} 秒",
"toolUseCount": "{count} 工具呼叫" "toolUseCount": "{count} 工具 {count, plural, one {use} other {uses}}"
}, },
"tool": { "tool": {
"parameters": "參數", "parameters": "參數",
@@ -1243,14 +1250,14 @@
"nameLabel": "名稱:", "nameLabel": "名稱:",
"field": { "field": {
"file": "檔案", "file": "檔案",
"notebook": "Notebook", "notebook": "筆記本",
"command": "命令", "command": "命令",
"old": "舊內容", "old": "舊內容",
"new": "新內容", "new": "新內容",
"pattern": "模式", "pattern": "模式",
"path": "路徑", "path": "路徑",
"query": "查詢", "query": "查詢",
"url": "URL", "url": "URL 位址",
"description": "描述", "description": "描述",
"content": "內容", "content": "內容",
"source": "來源內容", "source": "來源內容",

View File

@@ -1,11 +1,32 @@
import type { AppLocale, SystemLanguageSettings } from "@/lib/types" import type { AppLocale, SystemLanguageSettings } from "@/lib/types"
export const APP_LOCALES: readonly AppLocale[] = ["en", "zh_cn", "zh_tw"] export const APP_LOCALES: readonly AppLocale[] = [
"en",
"zh_cn",
"zh_tw",
"ja",
"ko",
"es",
"de",
"fr",
"pt",
"ar",
]
const FALLBACK_APP_LOCALE: AppLocale = "en" const FALLBACK_APP_LOCALE: AppLocale = "en"
export const LANGUAGE_SETTINGS_STORAGE_KEY = "codeg.system_language_settings" export const LANGUAGE_SETTINGS_STORAGE_KEY = "codeg.system_language_settings"
export const LANGUAGE_MODE_COOKIE_KEY = "codeg.language_mode" export const LANGUAGE_MODE_COOKIE_KEY = "codeg.language_mode"
export const LANGUAGE_COOKIE_KEY = "codeg.locale" export const LANGUAGE_COOKIE_KEY = "codeg.locale"
export type IntlLocale = "en" | "zh-CN" | "zh-TW" export type IntlLocale =
| "en"
| "zh-CN"
| "zh-TW"
| "ja"
| "ko"
| "es"
| "de"
| "fr"
| "pt"
| "ar"
export const DEFAULT_LANGUAGE_SETTINGS: SystemLanguageSettings = { export const DEFAULT_LANGUAGE_SETTINGS: SystemLanguageSettings = {
mode: "system", mode: "system",
@@ -16,12 +37,26 @@ export const APP_LOCALE_TO_INTL_LOCALE: Record<AppLocale, IntlLocale> = {
en: "en", en: "en",
zh_cn: "zh-CN", zh_cn: "zh-CN",
zh_tw: "zh-TW", zh_tw: "zh-TW",
ja: "ja",
ko: "ko",
es: "es",
de: "de",
fr: "fr",
pt: "pt",
ar: "ar",
} }
export const INTL_LOCALE_TO_APP_LOCALE: Record<IntlLocale, AppLocale> = { export const INTL_LOCALE_TO_APP_LOCALE: Record<IntlLocale, AppLocale> = {
en: "en", en: "en",
"zh-CN": "zh_cn", "zh-CN": "zh_cn",
"zh-TW": "zh_tw", "zh-TW": "zh_tw",
ja: "ja",
ko: "ko",
es: "es",
de: "de",
fr: "fr",
pt: "pt",
ar: "ar",
} }
export function isAppLocale(value: unknown): value is AppLocale { export function isAppLocale(value: unknown): value is AppLocale {
@@ -29,7 +64,18 @@ export function isAppLocale(value: unknown): value is AppLocale {
} }
export function isIntlLocale(value: unknown): value is IntlLocale { export function isIntlLocale(value: unknown): value is IntlLocale {
return value === "en" || value === "zh-CN" || value === "zh-TW" return (
value === "en" ||
value === "zh-CN" ||
value === "zh-TW" ||
value === "ja" ||
value === "ko" ||
value === "es" ||
value === "de" ||
value === "fr" ||
value === "pt" ||
value === "ar"
)
} }
export function toIntlLocale(locale: AppLocale): IntlLocale { export function toIntlLocale(locale: AppLocale): IntlLocale {
@@ -70,6 +116,13 @@ export function mapLocaleTagToAppLocale(localeTag: string): AppLocale | null {
} }
if (normalized.startsWith("zh")) return "zh_cn" if (normalized.startsWith("zh")) return "zh_cn"
if (normalized.startsWith("ja")) return "ja"
if (normalized.startsWith("ko")) return "ko"
if (normalized.startsWith("es")) return "es"
if (normalized.startsWith("de")) return "de"
if (normalized.startsWith("fr")) return "fr"
if (normalized.startsWith("pt")) return "pt"
if (normalized.startsWith("ar")) return "ar"
return null return null
} }

View File

@@ -554,7 +554,17 @@ export interface SystemProxySettings {
proxy_url: string | null proxy_url: string | null
} }
export type AppLocale = "en" | "zh_cn" | "zh_tw" export type AppLocale =
| "en"
| "zh_cn"
| "zh_tw"
| "ja"
| "ko"
| "es"
| "de"
| "fr"
| "pt"
| "ar"
export type LanguageMode = "system" | "manual" export type LanguageMode = "system" | "manual"
export interface SystemLanguageSettings { export interface SystemLanguageSettings {