Skip to content

Commit 824d2c2

Browse files
committed
feat(i18n): integrate PermissionPrompt, fix hardcoded tips in SessionList and WelcomeScreen
- PermissionPrompt: fully i18n-ized (17 strings -> t() calls), new locale module ui-permission-prompt.json with en/zh-CN translations - SessionList: fix 6 remaining hardcoded strings (delete confirm, footer help, waiting/denied statuses) - WelcomeScreen: fix 'Tips:' hardcoded prefix -> t('ui.welcome.tipsPrefix') - App.tsx: fix hardcoded permission denied status message - locales: add 25 new translation keys across 4 modules (total 267 keys) - docs: update i18n-todo.md with comprehensive scan results and new findings (PermissionPrompt, App.tsx, Tips component) - settings.ts: fix indentation (tab to spaces)
1 parent b065732 commit 824d2c2

14 files changed

Lines changed: 166 additions & 49 deletions

.deepcode/i18n-todo.md

Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
| `ui-welcome.json` | 🟢 | 🟢 | Phase 2 | WelcomeScreen | ✅ 完成 |
2424
| `ui-mcp.json` | 🟢 | 🟢 | Phase 2 | McpStatusList | ✅ 完成 |
2525
| `ui-slash-commands.json` | 🟢 | 🟢 | Phase 2 | slashCommands.ts | ✅ 完成 |
26-
| `ui-session-list.json` | 🟢 | 🟢 | Phase 2 | SessionList | ✅ 完成 |
26+
| `ui-session-list.json` | 🟢 | 🟢 | Phase 2 | SessionList | ⚠️ 部分(6处硬编码提示未翻译,见下方 §8 更新) |
2727
| `ui-ask-question.json` | 🟢 | 🟢 | Phase 2 | AskUserQuestionPrompt | ✅ 完成 |
2828
| `ui-process-stdout.json` | 🟢 | 🟢 | Phase 2 | ProcessStdoutView | ✅ 完成 |
2929
| `ui-update-prompt.json` | 🟢 | 🟢 | Phase 2 | UpdatePrompt | ✅ 完成 |
@@ -379,17 +379,29 @@
379379

380380
**文件**: `src/ui/SessionList.tsx`
381381

382+
> **更新 (2026-05-26)**:以下原始遗漏项已通过 `t()` 调用修复:escBack、total、matched、noMatch、untitled、above、below、footerHelp、statusDone/Running/Pending/Waiting/Failed/Stopped。✅
383+
384+
**仍为硬编码的 tips(以下文本未经翻译)**
385+
386+
**8a. 会话行内删除确认提示**
382387
| 行号 | 硬编码文本 | 建议 key |
383388
|------|-----------|---------|
384-
| 162 | `"Press Esc to go back."` | `ui.sessionList.escBack` |
385-
| 185 | `"total"` | `ui.sessionList.total` |
386-
| 186 | `", {n} matched"`(参数化) | `ui.sessionList.matched` |
387-
| 213 | `'No sessions match "{query}".'`(参数化) | `ui.sessionList.noMatch` |
388-
| 229 | `"Untitled"` | `ui.sessionList.untitled` |
389-
| 243 | `"sessions above."`(参数化) | `ui.sessionList.above` |
390-
| 245 | `"sessions below."`(参数化) | `ui.sessionList.below` |
391-
| 253-259 | Footer 帮助文本 | `ui.sessionList.footerHelp` |
392-
| 284-301 | `formatSessionStatus()` 状态值 | `ui.sessionList.statusDone`/`Running`/`Pending`/`Waiting`/`Failed`/`Stopped` |
389+
| 254 | `" [Delete? Enter=yes, Esc=no]"` | `ui.sessionList.deleteConfirmHint` |
390+
391+
**8b. Footer 删除确认帮助文本**
392+
| 行号 | 硬编码文本 | 建议 key |
393+
|------|-----------|---------|
394+
| 282 | `"Delete this session? "` | `ui.sessionList.deleteTitle` |
395+
| 286 | `" to confirm · "` | `ui.sessionList.confirmAction` |
396+
| 290 | `" to cancel"` | `ui.sessionList.cancelAction` |
397+
398+
**8c. `formatSessionStatus()` 状态值 — 这两个未走 `t()` 翻译**
399+
| 行号 | 硬编码文本 | 建议 key |
400+
|------|-----------|---------|
401+
| 338 | `"waiting"``ask_permission` 状态) | `ui.sessionList.statusPermission` |
402+
| 340 | `"denied"``permission_denied` 状态) | `ui.sessionList.statusDenied` |
403+
404+
> **共计 6 处硬编码字符串**,建议新增 6 个 translation key 到 `ui-session-list.json`
393405
394406
### 9. UndoSelector (`/undo` 命令二级页面) — 几乎完全未翻译
395407

@@ -424,6 +436,51 @@
424436
| 176 | `"timeout {duration}"` | `ui.processStdout.timeoutHint` |
425437
| 183 | `"Timeout set to {duration}"` | `ui.processStdout.timeoutSet` |
426438

439+
### 11. WelcomeScreen Tips 组件 — 遗漏翻译
440+
441+
**文件**: `src/ui/WelcomeScreen.tsx`
442+
443+
> **背景**`buildWelcomeTips()` 生成的随机快捷键提示行,"Tips:" 前缀为硬编码英文。
444+
445+
| 行号 | 硬编码文本 | 建议 key |
446+
|------|-----------|---------|
447+
| 82 | `"Tips: "`(第82行 `Tips: {tip.label} - {tip.description}`| `ui.welcome.tipsPrefix` |
448+
449+
> 快捷键描述已全部通过 `t("ui.welcome.*")` 翻译 ✅,仅前缀 "Tips:" 遗漏。
450+
451+
### 12. PermissionPrompt(权限请求弹窗)— 完全未翻译
452+
453+
**文件**: `src/ui/PermissionPrompt.tsx`
454+
455+
> 该组件整体未接入 i18n,所有用户可见文本均为硬编码英文。
456+
457+
| 行号 | 硬编码文本 | 建议 key |
458+
|------|-----------|---------|
459+
| 131 | `"Permission required"`(标题) | `ui.permissionPrompt.title` |
460+
| 142 | `"Do you want to proceed?"`(询问文案) | `ui.permissionPrompt.proceedQuestion` |
461+
| 153 | `"↑/↓ move · Enter select · Esc interrupt"`(底部帮助) | `ui.permissionPrompt.footerHelp` |
462+
| 182 | `"Yes"`(允许按钮) | `ui.permissionPrompt.allowLabel` |
463+
| 186 | `"Yes, and always allow "`(始终允许按钮) | `ui.permissionPrompt.alwaysAllowLabel` |
464+
| 191 | `"No"`(拒绝按钮) | `ui.permissionPrompt.denyLabel` |
465+
| 252 | `"reads inside this workspace"` | `ui.permissionPrompt.scopeReadInCwd` |
466+
| 254 | `"reads outside this workspace"` | `ui.permissionPrompt.scopeReadOutCwd` |
467+
| 256 | `"writes inside this workspace"` | `ui.permissionPrompt.scopeWriteInCwd` |
468+
| 258 | `"writes outside this workspace"` | `ui.permissionPrompt.scopeWriteOutCwd` |
469+
| 260 | `"deletes inside this workspace"` | `ui.permissionPrompt.scopeDeleteInCwd` |
470+
| 262 | `"deletes outside this workspace"` | `ui.permissionPrompt.scopeDeleteOutCwd` |
471+
| 264 | `"Git history queries"` | `ui.permissionPrompt.scopeQueryGitLog` |
472+
| 266 | `"Git history changes"` | `ui.permissionPrompt.scopeMutateGitLog` |
473+
| 268 | `"network access"` | `ui.permissionPrompt.scopeNetwork` |
474+
| 270 | `"MCP tool access"` | `ui.permissionPrompt.scopeMcp` |
475+
476+
### 13. App.tsx — 遗漏状态消息
477+
478+
**文件**: `src/ui/App.tsx`
479+
480+
| 行号 | 硬编码文本 | 建议 key |
481+
|------|-----------|---------|
482+
| 706 | `"Permission denied. Add a reply, then press Enter to continue."` | `ui.app.permissionDenied` |
483+
427484
---
428485

429486
## 已解决的已知问题
@@ -464,7 +521,7 @@
464521
| `ui.app.*` | 16 | 3 | 19% | 🔴 |
465522
| `ui.askUserQuestion.*` | 3 | 0 | 0% | 🔴 |
466523
| `ui.processStdout.*` | 4 | 0 | 0% | 🔴 |
467-
| `ui.sessionList.*` | 2 | 0 | 0% | 🔴 |
524+
| `ui.sessionList.*` | 19 | 19 | 100% | ✅ 全部使用;另有 6 处硬编码需新增 key(删除确认+waiting/denied) |
468525
| `ui.updatePrompt.*` | 1 | 0 | 0% | 🔴 |
469526
| `session.skillPromptHeader` | 1 | 0 | 0% | 🔴 |
470527

@@ -492,8 +549,6 @@
492549
| `ui.mcp.serverList` | McpStatusList 使用字面量 `"server-list"` |
493550
| `ui.mcp.statusConnecting` | McpStatusList 字面量 |
494551
| `ui.slashCommands.continueDesc` | slashCommands.ts 第 62 行硬编码英文 |
495-
| `ui.sessionList.title` | SessionList 硬编码 |
496-
| `ui.sessionList.empty` | SessionList 硬编码 |
497552
| `ui.askUserQuestion.submit` | AskUserQuestionPrompt 硬编码 |
498553
| `ui.askUserQuestion.cancel` | AskUserQuestionPrompt 硬编码 |
499554
| `ui.askUserQuestion.selectOption` | AskUserQuestionPrompt 硬编码 |

locales/en/ui-app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"apiKeyNotFound": "OpenAI API key not found. Please configure ~/.deepcode/settings.json or ./.deepcode/settings.json.",
1818
"requestFailed": "Request failed: {error}",
1919
"pressEscExitRaw": "Press ESC to exit raw mode",
20-
"noMessagesInSession": "(No messages in this session yet. Start chatting to see them here.)"
20+
"noMessagesInSession": "(No messages in this session yet. Start chatting to see them here.)",
21+
"permissionDenied": "Permission denied. Add a reply, then press Enter to continue."
2122
}
2223
}
2324
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"ui": {
3+
"permissionPrompt": {
4+
"title": "Permission required",
5+
"proceedQuestion": "Do you want to proceed?",
6+
"footerHelp": "\u2191/\u2193 move \u00b7 Enter select \u00b7 Esc interrupt",
7+
"allowLabel": "Yes",
8+
"alwaysAllowLabel": "Yes, and always allow ",
9+
"denyLabel": "No",
10+
"scopeReadInCwd": "reads inside this workspace",
11+
"scopeReadOutCwd": "reads outside this workspace",
12+
"scopeWriteInCwd": "writes inside this workspace",
13+
"scopeWriteOutCwd": "writes outside this workspace",
14+
"scopeDeleteInCwd": "deletes inside this workspace",
15+
"scopeDeleteOutCwd": "deletes outside this workspace",
16+
"scopeQueryGitLog": "Git history queries",
17+
"scopeMutateGitLog": "Git history changes",
18+
"scopeNetwork": "network access",
19+
"scopeMcp": "MCP tool access"
20+
}
21+
}
22+
}

locales/en/ui-session-list.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
"statusPending": "pending",
2020
"statusWaiting": "waiting",
2121
"statusFailed": "failed",
22-
"statusStopped": "stopped"
22+
"statusStopped": "stopped",
23+
"deleteConfirmHint": " [Delete? Enter=yes, Esc=no]",
24+
"deleteTitle": "Delete this session? ",
25+
"confirmAction": " to confirm · ",
26+
"cancelAction": " to cancel",
27+
"statusPermission": "waiting",
28+
"statusDenied": "denied"
2329
}
2430
}
2531
}

locales/en/ui-welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"thinkingEnabled": "Thinking Enabled",
1111
"reasoningEffort": "Reasoning Effort",
1212
"model": "Model",
13-
"cwd": "CWD"
13+
"cwd": "CWD",
14+
"tipsPrefix": "Tips: "
1415
}
1516
}
1617
}

locales/zh-CN/ui-app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"apiKeyNotFound": "未找到 OpenAI API key。请配置 ~/.deepcode/settings.json 或 ./.deepcode/settings.json。",
1818
"requestFailed": "请求失败:{error}",
1919
"pressEscExitRaw": "按 ESC 退出原始模式",
20-
"noMessagesInSession": "(此会话暂无消息,开始聊天即可看到)"
20+
"noMessagesInSession": "(此会话暂无消息,开始聊天即可看到)",
21+
"permissionDenied": "权限已拒绝。添加回复后按 Enter 继续。"
2122
}
2223
}
2324
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"ui": {
3+
"permissionPrompt": {
4+
"title": "需要权限",
5+
"proceedQuestion": "是否继续执行?",
6+
"footerHelp": "\u2191/\u2193 移动 \u00b7 Enter 选择 \u00b7 Esc 中断",
7+
"allowLabel": "",
8+
"alwaysAllowLabel": "是,始终允许 ",
9+
"denyLabel": "",
10+
"scopeReadInCwd": "读取工作目录内文件",
11+
"scopeReadOutCwd": "读取工作目录外文件",
12+
"scopeWriteInCwd": "写入工作目录内文件",
13+
"scopeWriteOutCwd": "写入工作目录外文件",
14+
"scopeDeleteInCwd": "删除工作目录内文件",
15+
"scopeDeleteOutCwd": "删除工作目录外文件",
16+
"scopeQueryGitLog": "查询 Git 历史",
17+
"scopeMutateGitLog": "修改 Git 历史",
18+
"scopeNetwork": "网络访问",
19+
"scopeMcp": "MCP 工具访问"
20+
}
21+
}
22+
}

locales/zh-CN/ui-session-list.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
"statusPending": "待处理",
2020
"statusWaiting": "等待中",
2121
"statusFailed": "失败",
22-
"statusStopped": "已停止"
22+
"statusStopped": "已停止",
23+
"deleteConfirmHint": " [删除?Enter=是, Esc=否]",
24+
"deleteTitle": "删除此会话?",
25+
"confirmAction": " 确认 · ",
26+
"cancelAction": " 取消",
27+
"statusPermission": "等待中",
28+
"statusDenied": "已拒绝"
2329
}
2430
}
2531
}

locales/zh-CN/ui-welcome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"thinkingEnabled": "思考模式",
1111
"reasoningEffort": "思考努力程度",
1212
"model": "模型",
13-
"cwd": "当前目录"
13+
"cwd": "当前目录",
14+
"tipsPrefix": "提示:"
1415
}
1516
}
1617
}

src/settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export type ResolvedDeepcodingSettings = {
6565
notify?: string;
6666
webSearchTool?: string;
6767
mcpServers?: Record<string, McpServerConfig>;
68-
permissions: Required<PermissionSettings>;
68+
permissions: Required<PermissionSettings>;
6969
locale: Locale;
7070
thinkingLocale: Locale;
7171
replyLocale: Locale;
@@ -354,7 +354,7 @@ export function resolveSettingsSources(
354354
notify: notify || undefined,
355355
webSearchTool: webSearchTool || undefined,
356356
mcpServers: mergeMcpServers(userSettings, projectSettings, userEnv, projectEnv, systemEnv),
357-
permissions: mergePermissions(userSettings, projectSettings),
357+
permissions: mergePermissions(userSettings, projectSettings),
358358
locale: resolveLocale(locale),
359359
thinkingLocale: resolveLocale(thinkingLocale),
360360
replyLocale: resolveLocale(replyLocale),

0 commit comments

Comments
 (0)