diff --git a/packages/cli/src/i18n/locales/en.js b/packages/cli/src/i18n/locales/en.js index 03b3c438..0898da3e 100644 --- a/packages/cli/src/i18n/locales/en.js +++ b/packages/cli/src/i18n/locales/en.js @@ -203,6 +203,7 @@ export default { // ============================================================================ // Commands - Approval Mode // ============================================================================ + 'Approval Mode': 'Approval Mode', 'Current approval mode: {{mode}}': 'Current approval mode: {{mode}}', 'Available approval modes:': 'Available approval modes:', 'Approval mode changed to: {{mode}}': 'Approval mode changed to: {{mode}}', @@ -236,6 +237,16 @@ export default { 'Persist for this project/workspace': 'Persist for this project/workspace', 'Persist for this user on this machine': 'Persist for this user on this machine', + 'Analyze only, do not modify files or execute commands': + 'Analyze only, do not modify files or execute commands', + 'Require approval for file edits or shell commands': + 'Require approval for file edits or shell commands', + 'Automatically approve file edits': 'Automatically approve file edits', + 'Automatically approve all tools': 'Automatically approve all tools', + 'Workspace approval mode exists and takes priority. User-level change will have no effect.': + 'Workspace approval mode exists and takes priority. User-level change will have no effect.', + '(Use Enter to select, Tab to change focus)': + '(Use Enter to select, Tab to change focus)', // ============================================================================ // Commands - Memory diff --git a/packages/cli/src/i18n/locales/zh.js b/packages/cli/src/i18n/locales/zh.js index d2677704..5967e72a 100644 --- a/packages/cli/src/i18n/locales/zh.js +++ b/packages/cli/src/i18n/locales/zh.js @@ -193,6 +193,7 @@ export default { // ============================================================================ // Commands - Approval Mode // ============================================================================ + 'Approval Mode': '审批模式', 'Current approval mode: {{mode}}': '当前审批模式:{{mode}}', 'Available approval modes:': '可用的审批模式:', 'Approval mode changed to: {{mode}}': '审批模式已更改为:{{mode}}', @@ -221,6 +222,16 @@ export default { 'Apply to current session only (temporary)': '仅应用于当前会话(临时)', 'Persist for this project/workspace': '持久化到此项目/工作区', 'Persist for this user on this machine': '持久化到此机器上的此用户', + 'Analyze only, do not modify files or execute commands': + '仅分析,不修改文件或执行命令', + 'Require approval for file edits or shell commands': + '需要批准文件编辑或 shell 命令', + 'Automatically approve file edits': '自动批准文件编辑', + 'Automatically approve all tools': '自动批准所有工具', + 'Workspace approval mode exists and takes priority. User-level change will have no effect.': + '工作区审批模式已存在并具有优先级。用户级别的更改将无效。', + '(Use Enter to select, Tab to change focus)': + '(使用 Enter 选择,Tab 切换焦点)', // ============================================================================ // Commands - Memory diff --git a/packages/cli/src/ui/commands/approvalModeCommand.ts b/packages/cli/src/ui/commands/approvalModeCommand.ts index 5528d86f..90ae774b 100644 --- a/packages/cli/src/ui/commands/approvalModeCommand.ts +++ b/packages/cli/src/ui/commands/approvalModeCommand.ts @@ -10,10 +10,13 @@ import type { OpenDialogActionReturn, } from './types.js'; import { CommandKind } from './types.js'; +import { t } from '../../i18n/index.js'; export const approvalModeCommand: SlashCommand = { name: 'approval-mode', - description: 'View or change the approval mode for tool usage', + get description() { + return t('View or change the approval mode for tool usage'); + }, kind: CommandKind.BUILT_IN, action: async ( _context: CommandContext, diff --git a/packages/cli/src/ui/components/ApprovalModeDialog.tsx b/packages/cli/src/ui/components/ApprovalModeDialog.tsx index eb6441ec..163a45fd 100644 --- a/packages/cli/src/ui/components/ApprovalModeDialog.tsx +++ b/packages/cli/src/ui/components/ApprovalModeDialog.tsx @@ -15,6 +15,7 @@ import { SettingScope } from '../../config/settings.js'; import { getScopeMessageForSetting } from '../../utils/dialogScopeUtils.js'; import { useKeypress } from '../hooks/useKeypress.js'; import { ScopeSelector } from './shared/ScopeSelector.js'; +import { t } from '../../i18n/index.js'; interface ApprovalModeDialogProps { /** Callback function when an approval mode is selected */ @@ -33,15 +34,15 @@ interface ApprovalModeDialogProps { const formatModeDescription = (mode: ApprovalMode): string => { switch (mode) { case ApprovalMode.PLAN: - return 'Analyze only, do not modify files or execute commands'; + return t('Analyze only, do not modify files or execute commands'); case ApprovalMode.DEFAULT: - return 'Require approval for file edits or shell commands'; + return t('Require approval for file edits or shell commands'); case ApprovalMode.AUTO_EDIT: - return 'Automatically approve file edits'; + return t('Automatically approve file edits'); case ApprovalMode.YOLO: - return 'Automatically approve all tools'; + return t('Automatically approve all tools'); default: - return `${mode} mode`; + return t('{{mode}} mode', { mode }); } }; @@ -134,7 +135,8 @@ export function ApprovalModeDialog({ {/* Approval Mode Selection */} - {focusSection === 'mode' ? '> ' : ' '}Approval Mode{' '} + {focusSection === 'mode' ? '> ' : ' '} + {t('Approval Mode')}{' '} {otherScopeModifiedMessage} @@ -167,15 +169,17 @@ export function ApprovalModeDialog({ {showWorkspacePriorityWarning && ( <> - ⚠ Workspace approval mode exists and takes priority. User-level - change will have no effect. + ⚠{' '} + {t( + 'Workspace approval mode exists and takes priority. User-level change will have no effect.', + )} )} - (Use Enter to select, Tab to change focus) + {t('(Use Enter to select, Tab to change focus)')}