mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
feat(i18n): add internationalization support for /approval-mode command
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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({
|
||||
<Box flexDirection="column" flexGrow={1}>
|
||||
{/* Approval Mode Selection */}
|
||||
<Text bold={focusSection === 'mode'} wrap="truncate">
|
||||
{focusSection === 'mode' ? '> ' : ' '}Approval Mode{' '}
|
||||
{focusSection === 'mode' ? '> ' : ' '}
|
||||
{t('Approval Mode')}{' '}
|
||||
<Text color={theme.text.secondary}>{otherScopeModifiedMessage}</Text>
|
||||
</Text>
|
||||
<Box height={1} />
|
||||
@@ -167,15 +169,17 @@ export function ApprovalModeDialog({
|
||||
{showWorkspacePriorityWarning && (
|
||||
<>
|
||||
<Text color={theme.status.warning} wrap="wrap">
|
||||
⚠ 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.',
|
||||
)}
|
||||
</Text>
|
||||
<Box height={1} />
|
||||
</>
|
||||
)}
|
||||
|
||||
<Text color={theme.text.secondary}>
|
||||
(Use Enter to select, Tab to change focus)
|
||||
{t('(Use Enter to select, Tab to change focus)')}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user