This commit is contained in:
LaZzyMan 2026-01-19 15:09:24 +08:00
parent 6e641b8def
commit f8e41fb7fa
5 changed files with 115 additions and 12 deletions

View file

@ -6,6 +6,7 @@ import type {
} from '@qwen-code/qwen-code-core';
import type { ConfirmationRequest } from '../../ui/types.js';
import chalk from 'chalk';
import { t } from '../../i18n/index.js';
/**
* Requests consent from the user to perform an action, by reading a Y/n
@ -21,7 +22,7 @@ export async function requestConsentNonInteractive(
): Promise<boolean> {
console.info(consentDescription);
const result = await promptForConsentNonInteractive(
'Do you want to continue? [Y/n]: ',
t('Do you want to continue? [Y/n]: '),
);
return result;
}
@ -40,7 +41,7 @@ export async function requestConsentInteractive(
addExtensionUpdateConfirmationRequest: (value: ConfirmationRequest) => void,
): Promise<boolean> {
return promptForConsentInteractive(
consentDescription + '\n\nDo you want to continue?',
consentDescription + '\n\n' + t('Do you want to continue?'),
addExtensionUpdateConfirmationRequest,
);
}
@ -105,44 +106,60 @@ export function extensionConsentString(
): string {
const output: string[] = [];
const mcpServerEntries = Object.entries(extensionConfig.mcpServers || {});
output.push(`Installing extension "${extensionConfig.name}".`);
output.push(
'**Extensions may introduce unexpected behavior. Ensure you have investigated the extension source and trust the author.**',
t('Installing extension "{{name}}".', { name: extensionConfig.name }),
);
output.push(
t(
'**Extensions may introduce unexpected behavior. Ensure you have investigated the extension source and trust the author.**',
),
);
if (mcpServerEntries.length) {
output.push('This extension will run the following MCP servers:');
output.push(t('This extension will run the following MCP servers:'));
for (const [key, mcpServer] of mcpServerEntries) {
const isLocal = !!mcpServer.command;
const source =
mcpServer.httpUrl ??
`${mcpServer.command || ''}${mcpServer.args ? ' ' + mcpServer.args.join(' ') : ''}`;
output.push(` * ${key} (${isLocal ? 'local' : 'remote'}): ${source}`);
output.push(
` * ${key} (${isLocal ? t('local') : t('remote')}): ${source}`,
);
}
}
if (commands && commands.length > 0) {
output.push(
`This extension will add the following commands: ${commands.join(', ')}.`,
t('This extension will add the following commands: {{commands}}.', {
commands: commands.join(', '),
}),
);
}
if (extensionConfig.contextFileName) {
const fileName = Array.isArray(extensionConfig.contextFileName)
? extensionConfig.contextFileName.join(', ')
: extensionConfig.contextFileName;
output.push(
`This extension will append info to your QWEN.md context using ${extensionConfig.contextFileName}`,
t(
'This extension will append info to your QWEN.md context using {{fileName}}',
{ fileName },
),
);
}
if (extensionConfig.excludeTools) {
output.push(
`This extension will exclude the following core tools: ${extensionConfig.excludeTools}`,
t('This extension will exclude the following core tools: {{tools}}', {
tools: extensionConfig.excludeTools.join(', '),
}),
);
}
if (skills.length > 0) {
output.push('This extension will install the following skills:');
output.push(t('This extension will install the following skills:'));
for (const skill of skills) {
output.push(` * ${chalk.bold(skill.name)}: ${skill.description}`);
}
}
if (subagents.length > 0) {
output.push('This extension will install the following subagents:');
output.push(t('This extension will install the following subagents:'));
for (const subagent of subagents) {
output.push(` * ${chalk.bold(subagent.name)}: ${subagent.description}`);
}
@ -192,6 +209,10 @@ export const requestConsentOrFail = async (
}
}
if (!(await requestConsent(extensionConsent))) {
throw new Error(`Installation cancelled for "${extensionConfig.name}".`);
throw new Error(
t('Installation cancelled for "{{name}}".', {
name: extensionConfig.name,
}),
);
}
};

View file

@ -383,6 +383,28 @@ export default {
'Erweiterung "{{name}}" für Bereich "{{scope}}" deaktiviert',
'Extension "{{name}}" enabled for scope "{{scope}}"':
'Erweiterung "{{name}}" für Bereich "{{scope}}" aktiviert',
'Do you want to continue? [Y/n]: ': 'Möchten Sie fortfahren? [Y/n]: ',
'Do you want to continue?': 'Möchten Sie fortfahren?',
'Installing extension "{{name}}".':
'Erweiterung "{{name}}" wird installiert.',
'**Extensions may introduce unexpected behavior. Ensure you have investigated the extension source and trust the author.**':
'**Erweiterungen können unerwartetes Verhalten verursachen. Stellen Sie sicher, dass Sie die Erweiterungsquelle untersucht haben und dem Autor vertrauen.**',
'This extension will run the following MCP servers:':
'Diese Erweiterung wird folgende MCP-Server ausführen:',
local: 'lokal',
remote: 'remote',
'This extension will add the following commands: {{commands}}.':
'Diese Erweiterung wird folgende Befehle hinzufügen: {{commands}}.',
'This extension will append info to your QWEN.md context using {{fileName}}':
'Diese Erweiterung wird Informationen zu Ihrem QWEN.md-Kontext mit {{fileName}} hinzufügen',
'This extension will exclude the following core tools: {{tools}}':
'Diese Erweiterung wird folgende Kernwerkzeuge ausschließen: {{tools}}',
'This extension will install the following skills:':
'Diese Erweiterung wird folgende Fähigkeiten installieren:',
'This extension will install the following subagents:':
'Diese Erweiterung wird folgende Unteragenten installieren:',
'Installation cancelled for "{{name}}".':
'Installation von "{{name}}" abgebrochen.',
'manage IDE integration': 'IDE-Integration verwalten',
'check status of IDE integration': 'Status der IDE-Integration prüfen',
'install required IDE companion for {{ideName}}':

View file

@ -378,6 +378,27 @@ export default {
'Extension "{{name}}" disabled for scope "{{scope}}"',
'Extension "{{name}}" enabled for scope "{{scope}}"':
'Extension "{{name}}" enabled for scope "{{scope}}"',
'Do you want to continue? [Y/n]: ': 'Do you want to continue? [Y/n]: ',
'Do you want to continue?': 'Do you want to continue?',
'Installing extension "{{name}}".': 'Installing extension "{{name}}".',
'**Extensions may introduce unexpected behavior. Ensure you have investigated the extension source and trust the author.**':
'**Extensions may introduce unexpected behavior. Ensure you have investigated the extension source and trust the author.**',
'This extension will run the following MCP servers:':
'This extension will run the following MCP servers:',
local: 'local',
remote: 'remote',
'This extension will add the following commands: {{commands}}.':
'This extension will add the following commands: {{commands}}.',
'This extension will append info to your QWEN.md context using {{fileName}}':
'This extension will append info to your QWEN.md context using {{fileName}}',
'This extension will exclude the following core tools: {{tools}}':
'This extension will exclude the following core tools: {{tools}}',
'This extension will install the following skills:':
'This extension will install the following skills:',
'This extension will install the following subagents:':
'This extension will install the following subagents:',
'Installation cancelled for "{{name}}".':
'Installation cancelled for "{{name}}".',
'manage IDE integration': 'manage IDE integration',
'check status of IDE integration': 'check status of IDE integration',
'install required IDE companion for {{ideName}}':

View file

@ -383,6 +383,26 @@ export default {
'Расширение "{{name}}" отключено для области "{{scope}}"',
'Extension "{{name}}" enabled for scope "{{scope}}"':
'Расширение "{{name}}" включено для области "{{scope}}"',
'Do you want to continue? [Y/n]: ': 'Хотите продолжить? [Y/n]: ',
'Do you want to continue?': 'Хотите продолжить?',
'Installing extension "{{name}}".': 'Установка расширения "{{name}}".',
'**Extensions may introduce unexpected behavior. Ensure you have investigated the extension source and trust the author.**':
'**Расширения могут вызывать неожиданное поведение. Убедитесь, что вы изучили источник расширения и доверяете автору.**',
'This extension will run the following MCP servers:':
'Это расширение запустит следующие MCP-серверы:',
local: 'локальный',
remote: 'удалённый',
'This extension will add the following commands: {{commands}}.':
'Это расширение добавит следующие команды: {{commands}}.',
'This extension will append info to your QWEN.md context using {{fileName}}':
'Это расширение добавит информацию в ваш контекст QWEN.md с помощью {{fileName}}',
'This extension will exclude the following core tools: {{tools}}':
'Это расширение исключит следующие основные инструменты: {{tools}}',
'This extension will install the following skills:':
'Это расширение установит следующие навыки:',
'This extension will install the following subagents:':
'Это расширение установит следующие подагенты:',
'Installation cancelled for "{{name}}".': 'Установка "{{name}}" отменена.',
'manage IDE integration': 'Управление интеграцией с IDE',
'check status of IDE integration': 'Проверить статус интеграции с IDE',
'install required IDE companion for {{ideName}}':

View file

@ -363,6 +363,25 @@ export default {
'扩展 "{{name}}" 已在作用域 "{{scope}}" 中禁用',
'Extension "{{name}}" enabled for scope "{{scope}}"':
'扩展 "{{name}}" 已在作用域 "{{scope}}" 中启用',
'Do you want to continue? [Y/n]: ': '是否继续?[Y/n]',
'Do you want to continue?': '是否继续?',
'Installing extension "{{name}}".': '正在安装扩展 "{{name}}"。',
'**Extensions may introduce unexpected behavior. Ensure you have investigated the extension source and trust the author.**':
'**扩展可能会引入意外行为。请确保您已调查过扩展源并信任作者。**',
'This extension will run the following MCP servers:':
'此扩展将运行以下 MCP 服务器:',
local: '本地',
remote: '远程',
'This extension will add the following commands: {{commands}}.':
'此扩展将添加以下命令:{{commands}}。',
'This extension will append info to your QWEN.md context using {{fileName}}':
'此扩展将使用 {{fileName}} 向您的 QWEN.md 上下文追加信息',
'This extension will exclude the following core tools: {{tools}}':
'此扩展将排除以下核心工具:{{tools}}',
'This extension will install the following skills:': '此扩展将安装以下技能:',
'This extension will install the following subagents:':
'此扩展将安装以下子代理:',
'Installation cancelled for "{{name}}".': '已取消安装 "{{name}}"。',
'manage IDE integration': '管理 IDE 集成',
'check status of IDE integration': '检查 IDE 集成状态',
'install required IDE companion for {{ideName}}':