Skip to content

fix(approval-prompts): translate Shell/Path confirm title and action labels#1561

Merged
esengine merged 1 commit into
mainfrom
fix/i18n-approval-prompt-labels-1560
May 22, 2026
Merged

fix(approval-prompts): translate Shell/Path confirm title and action labels#1561
esengine merged 1 commit into
mainfrom
fix/i18n-approval-prompt-labels-1560

Conversation

@esengine

Copy link
Copy Markdown
Owner

Summary

Issue #1560: when running the CLI in zh-CN, the shell-approval card still showed Run command / Run once / Always allow — … / Deny in English. toApprovalPrompt (core-utils) mints English labels deliberately so the ACP surface (no i18n layer) can render immediately, but the CLI surface was rendering those verbatim instead of running them through the active locale.

Fix

ShellConfirm and PathConfirm now override prompt.title and each action.label with locally-translated strings keyed off action.id plus prompt.data — that's how we still tell foreground vs background and read vs write apart even though the unified prompt.kind collapses both pairs into "shell" and "path".

New i18n keys (both EN.ts and zh-CN.ts, plus the type defs in types.ts):

  • shellConfirm.promptTitleRunCommand / promptTitleRunBackground
  • shellConfirm.actionRunOnce / actionAlwaysAllow (with {prefix}) / actionDeny
  • pathConfirm.promptTitleRead / promptTitleWrite
  • pathConfirm.actionAllowRead / actionAllowWrite / actionAlwaysAllow / actionDeny

Test plan

  • new setLanguageRuntime("zh-CN") case in tests/shell-confirm-render.test.tsx — asserts 运行命令 / 运行一次 / 始终允许 / 拒绝 render and the English labels do NOT survive
  • existing EN render test still passes (the data.prefix interpolation puts the prefix after Always allow — , so the existing toContain("Always allow") assertion still matches)
  • npm run verify passes (3554 tests)

Closes #1560

…labels (#1560)

`toApprovalPrompt` in core-utils mints English labels so the ACP surface
(no i18n layer) can render immediately — but the CLI surface was rendering
those English strings verbatim, leaving "Run command" / "Run once" /
"Always allow — …" / "Deny" on screen even when the locale was zh-CN.

ShellConfirm and PathConfirm now override `prompt.title` and each
`action.label` with locally-translated strings keyed off `action.id` and
`prompt.data` (so we can still tell foreground vs background and read vs
write apart, even after the unified `prompt.kind` collapses each pair).

New i18n keys in both EN.ts and zh-CN.ts:

- `shellConfirm.promptTitleRunCommand` / `promptTitleRunBackground`
- `shellConfirm.actionRunOnce` / `actionAlwaysAllow` (with `{prefix}`) / `actionDeny`
- `pathConfirm.promptTitleRead` / `promptTitleWrite`
- `pathConfirm.actionAllowRead` / `actionAllowWrite` / `actionAlwaysAllow` / `actionDeny`

Test plan:
- `tests/shell-confirm-render.test.tsx` gains a `setLanguageRuntime("zh-CN")`
  case that asserts 运行命令 / 运行一次 / 始终允许 / 拒绝 render and the
  English labels do NOT survive.
- `npm run verify` passes (3554 tests).

Closes #1560
@esengine esengine merged commit 77a7cd9 into main May 22, 2026
4 checks passed
@esengine esengine deleted the fix/i18n-approval-prompt-labels-1560 branch May 22, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

权限确认的时候显示英文,可以显示中文吗

1 participant