feat: Update docs

This commit is contained in:
pomelo-nwu
2025-11-17 21:52:50 +08:00
parent a33a00256d
commit 0707cb5ddf
6 changed files with 210 additions and 27 deletions

View File

@@ -112,8 +112,39 @@ export default {
'IDE integration is not supported in your current environment. To use this feature, run Qwen Code in one of these supported IDEs: VS Code or VS Code forks.':
'IDE integration is not supported in your current environment. To use this feature, run Qwen Code in one of these supported IDEs: VS Code or VS Code forks.',
'Set up GitHub Actions': 'Set up GitHub Actions',
'Configure terminal keybindings for multiline input (VS Code, Cursor, Windsurf)':
'Configure terminal keybindings for multiline input (VS Code, Cursor, Windsurf)',
'Configure terminal keybindings for multiline input (VS Code, Cursor, Windsurf, Trae)':
'Configure terminal keybindings for multiline input (VS Code, Cursor, Windsurf, Trae)',
'Please restart your terminal for the changes to take effect.':
'Please restart your terminal for the changes to take effect.',
'Failed to configure terminal: {{error}}':
'Failed to configure terminal: {{error}}',
'Could not determine {{terminalName}} config path on Windows: APPDATA environment variable is not set.':
'Could not determine {{terminalName}} config path on Windows: APPDATA environment variable is not set.',
'{{terminalName}} keybindings.json exists but is not a valid JSON array. Please fix the file manually or delete it to allow automatic configuration.':
'{{terminalName}} keybindings.json exists but is not a valid JSON array. Please fix the file manually or delete it to allow automatic configuration.',
'File: {{file}}': 'File: {{file}}',
'Failed to parse {{terminalName}} keybindings.json. The file contains invalid JSON. Please fix the file manually or delete it to allow automatic configuration.':
'Failed to parse {{terminalName}} keybindings.json. The file contains invalid JSON. Please fix the file manually or delete it to allow automatic configuration.',
'Error: {{error}}': 'Error: {{error}}',
'Shift+Enter binding already exists': 'Shift+Enter binding already exists',
'Ctrl+Enter binding already exists': 'Ctrl+Enter binding already exists',
'Existing keybindings detected. Will not modify to avoid conflicts.':
'Existing keybindings detected. Will not modify to avoid conflicts.',
'Please check and modify manually if needed: {{file}}':
'Please check and modify manually if needed: {{file}}',
'Added Shift+Enter and Ctrl+Enter keybindings to {{terminalName}}.':
'Added Shift+Enter and Ctrl+Enter keybindings to {{terminalName}}.',
'Modified: {{file}}': 'Modified: {{file}}',
'{{terminalName}} keybindings already configured.':
'{{terminalName}} keybindings already configured.',
'Failed to configure {{terminalName}}.':
'Failed to configure {{terminalName}}.',
'Your terminal is already configured for an optimal experience with multiline input (Shift+Enter and Ctrl+Enter).':
'Your terminal is already configured for an optimal experience with multiline input (Shift+Enter and Ctrl+Enter).',
'Could not detect terminal type. Supported terminals: VS Code, Cursor, Windsurf, and Trae.':
'Could not detect terminal type. Supported terminals: VS Code, Cursor, Windsurf, and Trae.',
'Terminal "{{terminal}}" is not supported yet.':
'Terminal "{{terminal}}" is not supported yet.',
// ============================================================================
// Commands - Language

View File

@@ -106,8 +106,37 @@ export default {
'IDE integration is not supported in your current environment. To use this feature, run Qwen Code in one of these supported IDEs: VS Code or VS Code forks.':
'您当前环境不支持 IDE 集成。要使用此功能,请在以下支持的 IDE 之一中运行 Qwen CodeVS Code 或 VS Code 分支版本。',
'Set up GitHub Actions': '设置 GitHub Actions',
'Configure terminal keybindings for multiline input (VS Code, Cursor, Windsurf)':
'配置终端按键绑定以支持多行输入VS Code、Cursor、Windsurf',
'Configure terminal keybindings for multiline input (VS Code, Cursor, Windsurf, Trae)':
'配置终端按键绑定以支持多行输入VS Code、Cursor、Windsurf、Trae',
'Please restart your terminal for the changes to take effect.':
'请重启终端以使更改生效。',
'Failed to configure terminal: {{error}}': '配置终端失败:{{error}}',
'Could not determine {{terminalName}} config path on Windows: APPDATA environment variable is not set.':
'无法确定 {{terminalName}} 在 Windows 上的配置路径:未设置 APPDATA 环境变量。',
'{{terminalName}} keybindings.json exists but is not a valid JSON array. Please fix the file manually or delete it to allow automatic configuration.':
'{{terminalName}} keybindings.json 存在但不是有效的 JSON 数组。请手动修复文件或删除它以允许自动配置。',
'File: {{file}}': '文件:{{file}}',
'Failed to parse {{terminalName}} keybindings.json. The file contains invalid JSON. Please fix the file manually or delete it to allow automatic configuration.':
'解析 {{terminalName}} keybindings.json 失败。文件包含无效的 JSON。请手动修复文件或删除它以允许自动配置。',
'Error: {{error}}': '错误:{{error}}',
'Shift+Enter binding already exists': 'Shift+Enter 绑定已存在',
'Ctrl+Enter binding already exists': 'Ctrl+Enter 绑定已存在',
'Existing keybindings detected. Will not modify to avoid conflicts.':
'检测到现有按键绑定。为避免冲突,不会修改。',
'Please check and modify manually if needed: {{file}}':
'如有需要,请手动检查并修改:{{file}}',
'Added Shift+Enter and Ctrl+Enter keybindings to {{terminalName}}.':
'已为 {{terminalName}} 添加 Shift+Enter 和 Ctrl+Enter 按键绑定。',
'Modified: {{file}}': '已修改:{{file}}',
'{{terminalName}} keybindings already configured.':
'{{terminalName}} 按键绑定已配置。',
'Failed to configure {{terminalName}}.': '配置 {{terminalName}} 失败。',
'Your terminal is already configured for an optimal experience with multiline input (Shift+Enter and Ctrl+Enter).':
'您的终端已配置为支持多行输入Shift+Enter 和 Ctrl+Enter的最佳体验。',
'Could not detect terminal type. Supported terminals: VS Code, Cursor, Windsurf, and Trae.':
'无法检测终端类型。支持的终端VS Code、Cursor、Windsurf 和 Trae。',
'Terminal "{{terminal}}" is not supported yet.':
'终端 "{{terminal}}" 尚未支持。',
// ============================================================================
// Commands - Language

View File

@@ -7,6 +7,7 @@
import type { MessageActionReturn, SlashCommand } from './types.js';
import { CommandKind } from './types.js';
import { terminalSetup } from '../utils/terminalSetup.js';
import { t } from '../../i18n/index.js';
/**
* Command to configure terminal keybindings for multiline input support.
@@ -16,8 +17,11 @@ import { terminalSetup } from '../utils/terminalSetup.js';
*/
export const terminalSetupCommand: SlashCommand = {
name: 'terminal-setup',
description:
'Configure terminal keybindings for multiline input (VS Code, Cursor, Windsurf, Trae)',
get description() {
return t(
'Configure terminal keybindings for multiline input (VS Code, Cursor, Windsurf, Trae)',
);
},
kind: CommandKind.BUILT_IN,
action: async (): Promise<MessageActionReturn> => {
@@ -27,7 +31,8 @@ export const terminalSetupCommand: SlashCommand = {
let content = result.message;
if (result.requiresRestart) {
content +=
'\n\nPlease restart your terminal for the changes to take effect.';
'\n\n' +
t('Please restart your terminal for the changes to take effect.');
}
return {
@@ -38,7 +43,9 @@ export const terminalSetupCommand: SlashCommand = {
} catch (error) {
return {
type: 'message',
content: `Failed to configure terminal: ${error}`,
content: t('Failed to configure terminal: {{error}}', {
error: String(error),
}),
messageType: 'error',
};
}

View File

@@ -30,6 +30,7 @@ import { exec } from 'node:child_process';
import { promisify } from 'node:util';
import { isKittyProtocolEnabled } from './kittyProtocolDetector.js';
import { VSCODE_SHIFT_ENTER_SEQUENCE } from './platformConstants.js';
import { t } from '../../i18n/index.js';
const execAsync = promisify(exec);
@@ -146,7 +147,10 @@ async function configureVSCodeStyle(
if (!configDir) {
return {
success: false,
message: `Could not determine ${terminalName} config path on Windows: APPDATA environment variable is not set.`,
message: t(
'Could not determine {{terminalName}} config path on Windows: APPDATA environment variable is not set.',
{ terminalName },
),
};
}
@@ -166,9 +170,12 @@ async function configureVSCodeStyle(
return {
success: false,
message:
`${terminalName} keybindings.json exists but is not a valid JSON array. ` +
`Please fix the file manually or delete it to allow automatic configuration.\n` +
`File: ${keybindingsFile}`,
t(
'{{terminalName}} keybindings.json exists but is not a valid JSON array. Please fix the file manually or delete it to allow automatic configuration.',
{ terminalName },
) +
'\n' +
t('File: {{file}}', { file: keybindingsFile }),
};
}
keybindings = parsedContent;
@@ -176,10 +183,14 @@ async function configureVSCodeStyle(
return {
success: false,
message:
`Failed to parse ${terminalName} keybindings.json. The file contains invalid JSON.\n` +
`Please fix the file manually or delete it to allow automatic configuration.\n` +
`File: ${keybindingsFile}\n` +
`Error: ${parseError}`,
t(
'Failed to parse {{terminalName}} keybindings.json. The file contains invalid JSON. Please fix the file manually or delete it to allow automatic configuration.',
{ terminalName },
) +
'\n' +
t('File: {{file}}', { file: keybindingsFile }) +
'\n' +
t('Error: {{error}}', { error: String(parseError) }),
};
}
} catch {
@@ -214,18 +225,23 @@ async function configureVSCodeStyle(
if (existingShiftEnter || existingCtrlEnter) {
const messages: string[] = [];
if (existingShiftEnter) {
messages.push(`- Shift+Enter binding already exists`);
messages.push('- ' + t('Shift+Enter binding already exists'));
}
if (existingCtrlEnter) {
messages.push(`- Ctrl+Enter binding already exists`);
messages.push('- ' + t('Ctrl+Enter binding already exists'));
}
return {
success: false,
message:
`Existing keybindings detected. Will not modify to avoid conflicts.\n` +
t(
'Existing keybindings detected. Will not modify to avoid conflicts.',
) +
'\n' +
messages.join('\n') +
'\n' +
`Please check and modify manually if needed: ${keybindingsFile}`,
t('Please check and modify manually if needed: {{file}}', {
file: keybindingsFile,
}),
};
}
@@ -263,19 +279,34 @@ async function configureVSCodeStyle(
await fs.writeFile(keybindingsFile, JSON.stringify(keybindings, null, 4));
return {
success: true,
message: `Added Shift+Enter and Ctrl+Enter keybindings to ${terminalName}.\nModified: ${keybindingsFile}`,
message:
t(
'Added Shift+Enter and Ctrl+Enter keybindings to {{terminalName}}.',
{
terminalName,
},
) +
'\n' +
t('Modified: {{file}}', { file: keybindingsFile }),
requiresRestart: true,
};
} else {
return {
success: true,
message: `${terminalName} keybindings already configured.`,
message: t('{{terminalName}} keybindings already configured.', {
terminalName,
}),
};
}
} catch (error) {
return {
success: false,
message: `Failed to configure ${terminalName}.\nFile: ${keybindingsFile}\nError: ${error}`,
message:
t('Failed to configure {{terminalName}}.', { terminalName }) +
'\n' +
t('File: {{file}}', { file: keybindingsFile }) +
'\n' +
t('Error: {{error}}', { error: String(error) }),
};
}
}
@@ -322,8 +353,9 @@ export async function terminalSetup(): Promise<TerminalSetupResult> {
if (isKittyProtocolEnabled()) {
return {
success: true,
message:
message: t(
'Your terminal is already configured for an optimal experience with multiline input (Shift+Enter and Ctrl+Enter).',
),
};
}
@@ -332,8 +364,9 @@ export async function terminalSetup(): Promise<TerminalSetupResult> {
if (!terminal) {
return {
success: false,
message:
'Could not detect terminal type. Supported terminals: VS Code, Cursor, and Windsurf.',
message: t(
'Could not detect terminal type. Supported terminals: VS Code, Cursor, Windsurf, and Trae.',
),
};
}
@@ -349,7 +382,9 @@ export async function terminalSetup(): Promise<TerminalSetupResult> {
default:
return {
success: false,
message: `Terminal "${terminal}" is not supported yet.`,
message: t('Terminal "{{terminal}}" is not supported yet.', {
terminal,
}),
};
}
}