feat: add i18n

This commit is contained in:
LaZzyMan 2026-01-19 10:08:21 +08:00
parent 592bf2bad1
commit c8b0efa4d9
6 changed files with 249 additions and 32 deletions

View file

@ -151,6 +151,7 @@ export default {
'Project Level ({{path}})': 'Projektebene ({{path}})',
'User Level ({{path}})': 'Benutzerebene ({{path}})',
'Built-in Agents': 'Integrierte Agenten',
'Extension Agents': 'Erweiterungs-Agenten',
'Using: {{count}} agents': 'Verwendet: {{count}} Agenten',
'View Agent': 'Agent anzeigen',
'Edit Agent': 'Agent bearbeiten',
@ -348,6 +349,40 @@ export default {
'List active extensions': 'Aktive Erweiterungen auflisten',
'Update extensions. Usage: update <extension-names>|--all':
'Erweiterungen aktualisieren. Verwendung: update <Erweiterungsnamen>|--all',
'Disable an extension': 'Erweiterung deaktivieren',
'Enable an extension': 'Erweiterung aktivieren',
'Install an extension from a git repo or local path':
'Erweiterung aus Git-Repository oder lokalem Pfad installieren',
'Uninstall an extension': 'Erweiterung deinstallieren',
'No extensions installed.': 'Keine Erweiterungen installiert.',
'Usage: /extensions update <extension-names>|--all':
'Verwendung: /extensions update <Erweiterungsnamen>|--all',
'Extension "{{name}}" not found.': 'Erweiterung "{{name}}" nicht gefunden.',
'No extensions to update.': 'Keine Erweiterungen zum Aktualisieren.',
'Usage: /extensions install <source>':
'Verwendung: /extensions install <Quelle>',
'Installing extension from "{{source}}"...':
'Installiere Erweiterung von "{{source}}"...',
'Extension "{{name}}" installed successfully.':
'Erweiterung "{{name}}" erfolgreich installiert.',
'Failed to install extension from "{{source}}": {{error}}':
'Fehler beim Installieren der Erweiterung von "{{source}}": {{error}}',
'Usage: /extensions uninstall <extension-name>':
'Verwendung: /extensions uninstall <Erweiterungsname>',
'Uninstalling extension "{{name}}"...':
'Deinstalliere Erweiterung "{{name}}"...',
'Extension "{{name}}" uninstalled successfully.':
'Erweiterung "{{name}}" erfolgreich deinstalliert.',
'Failed to uninstall extension "{{name}}": {{error}}':
'Fehler beim Deinstallieren der Erweiterung "{{name}}": {{error}}',
'Usage: /extensions {{command}} <extension> [--scope=<user|workspace>]':
'Verwendung: /extensions {{command}} <Erweiterung> [--scope=<user|workspace>]',
'Unsupported scope "{{scope}}", should be one of "user" or "workspace"':
'Nicht unterstützter Bereich "{{scope}}", sollte "user" oder "workspace" sein',
'Extension "{{name}}" disabled for scope "{{scope}}"':
'Erweiterung "{{name}}" für Bereich "{{scope}}" deaktiviert',
'Extension "{{name}}" enabled for scope "{{scope}}"':
'Erweiterung "{{name}}" für Bereich "{{scope}}" aktiviert',
'manage IDE integration': 'IDE-Integration verwalten',
'check status of IDE integration': 'Status der IDE-Integration prüfen',
'install required IDE companion for {{ideName}}':
@ -985,6 +1020,19 @@ export default {
'Session start time is unavailable, cannot calculate stats.':
'Sitzungsstartzeit nicht verfügbar, Statistiken können nicht berechnet werden.',
// ============================================================================
// Command Format Migration
// ============================================================================
'Command Format Migration': 'Befehlsformat-Migration',
'Found {{count}} TOML command file:': '{{count}} TOML-Befehlsdatei gefunden:',
'Found {{count}} TOML command files:':
'{{count}} TOML-Befehlsdateien gefunden:',
'... and {{count}} more': '... und {{count}} weitere',
'The TOML format is deprecated. Would you like to migrate them to Markdown format?':
'Das TOML-Format ist veraltet. Möchten Sie sie ins Markdown-Format migrieren?',
'(Backups will be created and original files will be preserved)':
'(Backups werden erstellt und Originaldateien werden beibehalten)',
// ============================================================================
// Loading Phrases
// ============================================================================

View file

@ -152,6 +152,7 @@ export default {
'Project Level ({{path}})': 'Project Level ({{path}})',
'User Level ({{path}})': 'User Level ({{path}})',
'Built-in Agents': 'Built-in Agents',
'Extension Agents': 'Extension Agents',
'Using: {{count}} agents': 'Using: {{count}} agents',
'View Agent': 'View Agent',
'Edit Agent': 'Edit Agent',
@ -344,6 +345,39 @@ export default {
'List active extensions': 'List active extensions',
'Update extensions. Usage: update <extension-names>|--all':
'Update extensions. Usage: update <extension-names>|--all',
'Disable an extension': 'Disable an extension',
'Enable an extension': 'Enable an extension',
'Install an extension from a git repo or local path':
'Install an extension from a git repo or local path',
'Uninstall an extension': 'Uninstall an extension',
'No extensions installed.': 'No extensions installed.',
'Usage: /extensions update <extension-names>|--all':
'Usage: /extensions update <extension-names>|--all',
'Extension "{{name}}" not found.': 'Extension "{{name}}" not found.',
'No extensions to update.': 'No extensions to update.',
'Usage: /extensions install <source>': 'Usage: /extensions install <source>',
'Installing extension from "{{source}}"...':
'Installing extension from "{{source}}"...',
'Extension "{{name}}" installed successfully.':
'Extension "{{name}}" installed successfully.',
'Failed to install extension from "{{source}}": {{error}}':
'Failed to install extension from "{{source}}": {{error}}',
'Usage: /extensions uninstall <extension-name>':
'Usage: /extensions uninstall <extension-name>',
'Uninstalling extension "{{name}}"...':
'Uninstalling extension "{{name}}"...',
'Extension "{{name}}" uninstalled successfully.':
'Extension "{{name}}" uninstalled successfully.',
'Failed to uninstall extension "{{name}}": {{error}}':
'Failed to uninstall extension "{{name}}": {{error}}',
'Usage: /extensions {{command}} <extension> [--scope=<user|workspace>]':
'Usage: /extensions {{command}} <extension> [--scope=<user|workspace>]',
'Unsupported scope "{{scope}}", should be one of "user" or "workspace"':
'Unsupported scope "{{scope}}", should be one of "user" or "workspace"',
'Extension "{{name}}" disabled for scope "{{scope}}"':
'Extension "{{name}}" disabled for scope "{{scope}}"',
'Extension "{{name}}" enabled for scope "{{scope}}"':
'Extension "{{name}}" enabled for scope "{{scope}}"',
'manage IDE integration': 'manage IDE integration',
'check status of IDE integration': 'check status of IDE integration',
'install required IDE companion for {{ideName}}':
@ -958,6 +992,18 @@ export default {
'Session start time is unavailable, cannot calculate stats.':
'Session start time is unavailable, cannot calculate stats.',
// ============================================================================
// Command Format Migration
// ============================================================================
'Command Format Migration': 'Command Format Migration',
'Found {{count}} TOML command file:': 'Found {{count}} TOML command file:',
'Found {{count}} TOML command files:': 'Found {{count}} TOML command files:',
'... and {{count}} more': '... and {{count}} more',
'The TOML format is deprecated. Would you like to migrate them to Markdown format?':
'The TOML format is deprecated. Would you like to migrate them to Markdown format?',
'(Backups will be created and original files will be preserved)':
'(Backups will be created and original files will be preserved)',
// ============================================================================
// Loading Phrases
// ============================================================================

View file

@ -155,6 +155,7 @@ export default {
'Project Level ({{path}})': 'Уровень проекта ({{path}})',
'User Level ({{path}})': 'Уровень пользователя ({{path}})',
'Built-in Agents': 'Встроенные агенты',
'Extension Agents': 'Агенты расширений',
'Using: {{count}} agents': 'Используется: {{count}} агент(ов)',
'View Agent': 'Просмотреть агента',
'Edit Agent': 'Редактировать агента',
@ -349,6 +350,39 @@ export default {
'List active extensions': 'Показать активные расширения',
'Update extensions. Usage: update <extension-names>|--all':
'Обновить расширения. Использование: update <extension-names>|--all',
'Disable an extension': 'Отключить расширение',
'Enable an extension': 'Включить расширение',
'Install an extension from a git repo or local path':
'Установить расширение из Git-репозитория или локального пути',
'Uninstall an extension': 'Удалить расширение',
'No extensions installed.': 'Расширения не установлены.',
'Usage: /extensions update <extension-names>|--all':
'Использование: /extensions update <имена-расширений>|--all',
'Extension "{{name}}" not found.': 'Расширение "{{name}}" не найдено.',
'No extensions to update.': 'Нет расширений для обновления.',
'Usage: /extensions install <source>':
'Использование: /extensions install <источник>',
'Installing extension from "{{source}}"...':
'Установка расширения из "{{source}}"...',
'Extension "{{name}}" installed successfully.':
'Расширение "{{name}}" успешно установлено.',
'Failed to install extension from "{{source}}": {{error}}':
'Не удалось установить расширение из "{{source}}": {{error}}',
'Usage: /extensions uninstall <extension-name>':
'Использование: /extensions uninstall <имя-расширения>',
'Uninstalling extension "{{name}}"...': 'Удаление расширения "{{name}}"...',
'Extension "{{name}}" uninstalled successfully.':
'Расширение "{{name}}" успешно удалено.',
'Failed to uninstall extension "{{name}}": {{error}}':
'Не удалось удалить расширение "{{name}}": {{error}}',
'Usage: /extensions {{command}} <extension> [--scope=<user|workspace>]':
'Использование: /extensions {{command}} <расширение> [--scope=<user|workspace>]',
'Unsupported scope "{{scope}}", should be one of "user" or "workspace"':
'Неподдерживаемая область "{{scope}}", должна быть "user" или "workspace"',
'Extension "{{name}}" disabled for scope "{{scope}}"':
'Расширение "{{name}}" отключено для области "{{scope}}"',
'Extension "{{name}}" enabled for scope "{{scope}}"':
'Расширение "{{name}}" включено для области "{{scope}}"',
'manage IDE integration': 'Управление интеграцией с IDE',
'check status of IDE integration': 'Проверить статус интеграции с IDE',
'install required IDE companion for {{ideName}}':
@ -975,6 +1009,19 @@ export default {
'Session start time is unavailable, cannot calculate stats.':
'Время начала сессии недоступно, невозможно рассчитать статистику.',
// ============================================================================
// Command Format Migration
// ============================================================================
'Command Format Migration': 'Миграция формата команд',
'Found {{count}} TOML command file:': 'Найден {{count}} файл команд TOML:',
'Found {{count}} TOML command files:':
'Найдено {{count}} файлов команд TOML:',
'... and {{count}} more': '... и ещё {{count}}',
'The TOML format is deprecated. Would you like to migrate them to Markdown format?':
'Формат TOML устарел. Хотите перенести их в формат Markdown?',
'(Backups will be created and original files will be preserved)':
'(Будут созданы резервные копии, исходные файлы будут сохранены)',
// ============================================================================
// Loading Phrases
// ============================================================================

View file

@ -149,6 +149,7 @@ export default {
'Project Level ({{path}})': '项目级 ({{path}})',
'User Level ({{path}})': '用户级 ({{path}})',
'Built-in Agents': '内置代理',
'Extension Agents': '扩展代理',
'Using: {{count}} agents': '使用中: {{count}} 个代理',
'View Agent': '查看代理',
'Edit Agent': '编辑代理',
@ -331,6 +332,37 @@ export default {
'List active extensions': '列出活动扩展',
'Update extensions. Usage: update <extension-names>|--all':
'更新扩展。用法update <extension-names>|--all',
'Disable an extension': '禁用扩展',
'Enable an extension': '启用扩展',
'Install an extension from a git repo or local path':
'从 Git 仓库或本地路径安装扩展',
'Uninstall an extension': '卸载扩展',
'No extensions installed.': '未安装扩展。',
'Usage: /extensions update <extension-names>|--all':
'用法:/extensions update <扩展名>|--all',
'Extension "{{name}}" not found.': '未找到扩展 "{{name}}"。',
'No extensions to update.': '没有可更新的扩展。',
'Usage: /extensions install <source>': '用法:/extensions install <来源>',
'Installing extension from "{{source}}"...':
'正在从 "{{source}}" 安装扩展...',
'Extension "{{name}}" installed successfully.': '扩展 "{{name}}" 安装成功。',
'Failed to install extension from "{{source}}": {{error}}':
'从 "{{source}}" 安装扩展失败:{{error}}',
'Usage: /extensions uninstall <extension-name>':
'用法:/extensions uninstall <扩展名>',
'Uninstalling extension "{{name}}"...': '正在卸载扩展 "{{name}}"...',
'Extension "{{name}}" uninstalled successfully.':
'扩展 "{{name}}" 卸载成功。',
'Failed to uninstall extension "{{name}}": {{error}}':
'卸载扩展 "{{name}}" 失败:{{error}}',
'Usage: /extensions {{command}} <extension> [--scope=<user|workspace>]':
'用法:/extensions {{command}} <扩展> [--scope=<user|workspace>]',
'Unsupported scope "{{scope}}", should be one of "user" or "workspace"':
'不支持的作用域 "{{scope}}",应为 "user" 或 "workspace"',
'Extension "{{name}}" disabled for scope "{{scope}}"':
'扩展 "{{name}}" 已在作用域 "{{scope}}" 中禁用',
'Extension "{{name}}" enabled for scope "{{scope}}"':
'扩展 "{{name}}" 已在作用域 "{{scope}}" 中启用',
'manage IDE integration': '管理 IDE 集成',
'check status of IDE integration': '检查 IDE 集成状态',
'install required IDE companion for {{ideName}}':
@ -911,6 +943,18 @@ export default {
'Session start time is unavailable, cannot calculate stats.':
'会话开始时间不可用,无法计算统计信息',
// ============================================================================
// Command Format Migration
// ============================================================================
'Command Format Migration': '命令格式迁移',
'Found {{count}} TOML command file:': '发现 {{count}} 个 TOML 命令文件:',
'Found {{count}} TOML command files:': '发现 {{count}} 个 TOML 命令文件:',
'... and {{count}} more': '... 以及其他 {{count}} 个',
'The TOML format is deprecated. Would you like to migrate them to Markdown format?':
'TOML 格式已弃用。是否将它们迁移到 Markdown 格式?',
'(Backups will be created and original files will be preserved)':
'(将创建备份,原始文件将保留)',
// ============================================================================
// Loading Phrases
// ============================================================================

View file

@ -9,6 +9,7 @@ import type { RadioSelectItem } from './components/shared/RadioButtonSelect.js';
import { RadioButtonSelect } from './components/shared/RadioButtonSelect.js';
import { useKeypress } from './hooks/useKeypress.js';
import { theme } from './semantic-colors.js';
import { t } from '../i18n/index.js';
export type CommandMigrationNudgeResult = {
userSelection: 'yes' | 'no';
@ -36,14 +37,14 @@ export function CommandFormatMigrationNudge({
const OPTIONS: Array<RadioSelectItem<CommandMigrationNudgeResult>> = [
{
label: 'Yes',
label: t('Yes'),
value: {
userSelection: 'yes',
},
key: 'Yes',
},
{
label: 'No (esc)',
label: t('No (esc)'),
value: {
userSelection: 'no',
},
@ -55,7 +56,7 @@ export function CommandFormatMigrationNudge({
const fileList =
count <= 3
? tomlFiles.map((f) => `${f}`).join('\n')
: `${tomlFiles.slice(0, 2).join('\n • ')}\n • ... and ${count - 2} more`;
: `${tomlFiles.slice(0, 2).join('\n • ')}\n • ${t('... and {{count}} more', { count: String(count - 2) })}`;
return (
<Box
@ -69,19 +70,22 @@ export function CommandFormatMigrationNudge({
<Box marginBottom={1} flexDirection="column">
<Text>
<Text color={theme.status.warning}>{'⚠️ '}</Text>
<Text bold>Command Format Migration</Text>
<Text bold>{t('Command Format Migration')}</Text>
</Text>
<Text color={theme.text.secondary}>
{`Found ${count} TOML command file${count > 1 ? 's' : ''}:`}
{count > 1
? t('Found {{count}} TOML command files:', { count: String(count) })
: t('Found {{count}} TOML command file:', { count: String(count) })}
</Text>
<Text color={theme.text.secondary}>{fileList}</Text>
<Text>{''}</Text>
<Text color={theme.text.secondary}>
The TOML format is deprecated. Would you like to migrate them to
Markdown format?
{t(
'The TOML format is deprecated. Would you like to migrate them to Markdown format?',
)}
</Text>
<Text color={theme.text.secondary}>
(Backups will be created and original files will be preserved)
{t('(Backups will be created and original files will be preserved)')}
</Text>
</Box>
<RadioButtonSelect items={OPTIONS} onSelect={onComplete} />

View file

@ -28,7 +28,7 @@ function showMessageIfNoExtensions(
context.ui.addItem(
{
type: MessageType.INFO,
text: 'No extensions installed. Run `/extensions explore` to check out the gallery.',
text: t('No extensions installed.'),
},
Date.now(),
);
@ -63,7 +63,7 @@ async function updateAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.ERROR,
text: 'Usage: /extensions update <extension-names>|--all',
text: t('Usage: /extensions update <extension-names>|--all'),
},
Date.now(),
);
@ -113,7 +113,7 @@ async function updateAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.ERROR,
text: `Extension ${name} not found.`,
text: t('Extension "{{name}}" not found.', { name }),
},
Date.now(),
);
@ -137,7 +137,7 @@ async function updateAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.INFO,
text: 'No extensions to update.',
text: t('No extensions to update.'),
},
Date.now(),
);
@ -177,7 +177,7 @@ async function installAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.ERROR,
text: `Usage: /extensions install <source>`,
text: t('Usage: /extensions install <source>'),
},
Date.now(),
);
@ -189,7 +189,7 @@ async function installAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.INFO,
text: `Installing extension from "${source}"...`,
text: t('Installing extension from "{{source}}"...', { source }),
},
Date.now(),
);
@ -197,7 +197,9 @@ async function installAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.INFO,
text: `Extension "${extension.name}" installed successfully.`,
text: t('Extension "{{name}}" installed successfully.', {
name: extension.name,
}),
},
Date.now(),
);
@ -207,9 +209,10 @@ async function installAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.ERROR,
text: `Failed to install extension from "${source}": ${getErrorMessage(
error,
)}`,
text: t('Failed to install extension from "{{source}}": {{error}}', {
source,
error: getErrorMessage(error),
}),
},
Date.now(),
);
@ -231,7 +234,7 @@ async function uninstallAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.ERROR,
text: `Usage: /extensions uninstall <extension-name>`,
text: t('Usage: /extensions uninstall <extension-name>'),
},
Date.now(),
);
@ -241,7 +244,7 @@ async function uninstallAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.INFO,
text: `Uninstalling extension "${name}"...`,
text: t('Uninstalling extension "{{name}}"...', { name }),
},
Date.now(),
);
@ -251,7 +254,7 @@ async function uninstallAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.INFO,
text: `Extension "${name}" uninstalled successfully.`,
text: t('Extension "{{name}}" uninstalled successfully.', { name }),
},
Date.now(),
);
@ -260,9 +263,10 @@ async function uninstallAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.ERROR,
text: `Failed to uninstall extension "${name}": ${getErrorMessage(
error,
)}`,
text: t('Failed to uninstall extension "{{name}}": {{error}}', {
name,
error: getErrorMessage(error),
}),
},
Date.now(),
);
@ -296,7 +300,12 @@ function getEnableDisableContext(
context.ui.addItem(
{
type: MessageType.ERROR,
text: `Usage: /extensions ${context.invocation?.name} <extension> [--scope=<user|workspace>]`,
text: t(
'Usage: /extensions {{command}} <extension> [--scope=<user|workspace>]',
{
command: context.invocation?.name ?? '',
},
),
},
Date.now(),
);
@ -319,7 +328,12 @@ function getEnableDisableContext(
context.ui.addItem(
{
type: MessageType.ERROR,
text: `Unsupported scope ${parts[2]}, should be one of "user" or "workspace"`,
text: t(
'Unsupported scope "{{scope}}", should be one of "user" or "workspace"',
{
scope: parts[2],
},
),
},
Date.now(),
);
@ -356,7 +370,10 @@ async function disableAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.INFO,
text: `Extension "${name}" disabled for the scope "${scope}"`,
text: t('Extension "{{name}}" disabled for scope "{{scope}}"', {
name,
scope,
}),
},
Date.now(),
);
@ -374,7 +391,10 @@ async function enableAction(context: CommandContext, args: string) {
context.ui.addItem(
{
type: MessageType.INFO,
text: `Extension "${name}" enabled for the scope "${scope}"`,
text: t('Extension "{{name}}" enabled for scope "{{scope}}"', {
name,
scope,
}),
},
Date.now(),
);
@ -441,7 +461,9 @@ const updateExtensionsCommand: SlashCommand = {
const disableCommand: SlashCommand = {
name: 'disable',
description: 'Disable an extension',
get description() {
return t('Disable an extension');
},
kind: CommandKind.BUILT_IN,
action: disableAction,
completion: completeExtensionsAndScopes,
@ -449,7 +471,9 @@ const disableCommand: SlashCommand = {
const enableCommand: SlashCommand = {
name: 'enable',
description: 'Enable an extension',
get description() {
return t('Enable an extension');
},
kind: CommandKind.BUILT_IN,
action: enableAction,
completion: completeExtensionsAndScopes,
@ -457,14 +481,18 @@ const enableCommand: SlashCommand = {
const installCommand: SlashCommand = {
name: 'install',
description: 'Install an extension from a git repo or local path',
get description() {
return t('Install an extension from a git repo or local path');
},
kind: CommandKind.BUILT_IN,
action: installAction,
};
const uninstallCommand: SlashCommand = {
name: 'uninstall',
description: 'Uninstall an extension',
get description() {
return t('Uninstall an extension');
},
kind: CommandKind.BUILT_IN,
action: uninstallAction,
completion: completeExtensions,