diff --git a/packages/cli/src/i18n/locales/de.js b/packages/cli/src/i18n/locales/de.js index aa4a6d552..47312f9f2 100644 --- a/packages/cli/src/i18n/locales/de.js +++ b/packages/cli/src/i18n/locales/de.js @@ -594,6 +594,112 @@ export default { 'List all configured hooks': 'Alle konfigurierten Hooks auflisten', 'Enable a disabled hook': 'Einen deaktivierten Hook aktivieren', 'Disable an active hook': 'Einen aktiven Hook deaktivieren', + // Hooks - Dialog + Hooks: 'Hooks', + 'Loading hooks...': 'Hooks werden geladen...', + 'Error loading hooks:': 'Fehler beim Laden der Hooks:', + 'Press Escape to close': 'Escape zum Schließen drücken', + 'No hook selected': 'Kein Hook ausgewählt', + // Hooks - List Step + 'No hook events found.': 'Keine Hook-Ereignisse gefunden.', + '{{count}} hook configured': '{{count}} Hook konfiguriert', + '{{count}} hooks configured': '{{count}} Hooks konfiguriert', + 'This menu is read-only. To add or modify hooks, edit settings.json directly or ask Qwen Code.': + 'Dieses Menü ist schreibgeschützt. Um Hooks hinzuzufügen oder zu ändern, bearbeiten Sie settings.json direkt oder fragen Sie Qwen Code.', + 'Enter to select · Esc to cancel': 'Enter zum Auswählen · Esc zum Abbrechen', + // Hooks - Detail Step + 'Exit codes:': 'Exit-Codes:', + 'Configured hooks:': 'Konfigurierte Hooks:', + 'No hooks configured for this event.': + 'Für dieses Ereignis sind keine Hooks konfiguriert.', + 'To add hooks, edit settings.json directly or ask Qwen.': + 'Um Hooks hinzuzufügen, bearbeiten Sie settings.json direkt oder fragen Sie Qwen.', + // Hooks - Source + Project: 'Projekt', + User: 'Benutzer', + System: 'System', + Extension: 'Erweiterung', + 'Local Settings': 'Lokale Einstellungen', + 'User Settings': 'Benutzereinstellungen', + 'System Settings': 'Systemeinstellungen', + Extensions: 'Erweiterungen', + // Hooks - Status + '✓ Enabled': '✓ Aktiviert', + '✗ Disabled': '✗ Deaktiviert', + // Hooks - Event Descriptions (short) + 'Before tool execution': 'Vor der Tool-Ausführung', + 'After tool execution': 'Nach der Tool-Ausführung', + 'After tool execution fails': 'Wenn die Tool-Ausführung fehlschlägt', + 'When notifications are sent': 'Wenn Benachrichtigungen gesendet werden', + 'When the user submits a prompt': 'Wenn der Benutzer einen Prompt absendet', + 'When a new session is started': 'Wenn eine neue Sitzung gestartet wird', + 'Right before Qwen Code concludes its response': + 'Direkt bevor Qwen Code seine Antwort abschließt', + 'When a subagent (Agent tool call) is started': + 'Wenn ein Subagent (Agent-Tool-Aufruf) gestartet wird', + 'Right before a subagent concludes its response': + 'Direkt bevor ein Subagent seine Antwort abschließt', + 'Before conversation compaction': 'Vor der Gesprächskomprimierung', + 'When a session is ending': 'Wenn eine Sitzung endet', + 'When a permission dialog is displayed': + 'Wenn ein Berechtigungsdialog angezeigt wird', + // Hooks - Event Descriptions (detailed) + 'Input to command is JSON of tool call arguments.': + 'Die Eingabe an den Befehl ist JSON der Tool-Aufruf-Argumente.', + 'Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).': + 'Die Eingabe an den Befehl ist JSON mit den Feldern "inputs" (Tool-Aufruf-Argumente) und "response" (Tool-Aufruf-Antwort).', + 'Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.': + 'Die Eingabe an den Befehl ist JSON mit tool_name, tool_input, tool_use_id, error, error_type, is_interrupt und is_timeout.', + 'Input to command is JSON with notification message and type.': + 'Die Eingabe an den Befehl ist JSON mit Benachrichtigungsnachricht und -typ.', + 'Input to command is JSON with original user prompt text.': + 'Die Eingabe an den Befehl ist JSON mit dem ursprünglichen Benutzer-Prompt-Text.', + 'Input to command is JSON with session start source.': + 'Die Eingabe an den Befehl ist JSON mit der Sitzungsstart-Quelle.', + 'Input to command is JSON with session end reason.': + 'Die Eingabe an den Befehl ist JSON mit dem Sitzungsende-Grund.', + 'Input to command is JSON with agent_id and agent_type.': + 'Die Eingabe an den Befehl ist JSON mit agent_id und agent_type.', + 'Input to command is JSON with agent_id, agent_type, and agent_transcript_path.': + 'Die Eingabe an den Befehl ist JSON mit agent_id, agent_type und agent_transcript_path.', + 'Input to command is JSON with compaction details.': + 'Die Eingabe an den Befehl ist JSON mit Komprimierungsdetails.', + 'Input to command is JSON with tool_name, tool_input, and tool_use_id. Output JSON with hookSpecificOutput containing decision to allow or deny.': + 'Die Eingabe an den Befehl ist JSON mit tool_name, tool_input und tool_use_id. Ausgabe ist JSON mit hookSpecificOutput, das die Entscheidung zum Zulassen oder Ablehnen enthält.', + // Hooks - Exit Code Descriptions + 'stdout/stderr not shown': 'stdout/stderr nicht angezeigt', + 'show stderr to model and continue conversation': + 'stderr dem Modell anzeigen und Konversation fortsetzen', + 'show stderr to user only': 'stderr nur dem Benutzer anzeigen', + 'stdout shown in transcript mode (ctrl+o)': + 'stdout im Transkriptmodus angezeigt (ctrl+o)', + 'show stderr to model immediately': 'stderr sofort dem Modell anzeigen', + 'show stderr to user only but continue with tool call': + 'stderr nur dem Benutzer anzeigen, aber mit Tool-Aufruf fortfahren', + 'block processing, erase original prompt, and show stderr to user only': + 'Verarbeitung blockieren, ursprünglichen Prompt löschen und stderr nur dem Benutzer anzeigen', + 'stdout shown to model': 'stdout dem Modell anzeigen', + 'show stderr to user only (blocking errors ignored)': + 'stderr nur dem Benutzer anzeigen (Blockierungsfehler ignoriert)', + 'command completes successfully': 'Befehl erfolgreich abgeschlossen', + 'stdout shown to subagent': 'stdout dem Subagenten anzeigen', + 'show stderr to subagent and continue having it run': + 'stderr dem Subagenten anzeigen und ihn weiterlaufen lassen', + 'stdout appended as custom compact instructions': + 'stdout als benutzerdefinierte Komprimierungsanweisungen angehängt', + 'block compaction': 'Komprimierung blockieren', + 'show stderr to user only but continue with compaction': + 'stderr nur dem Benutzer anzeigen, aber mit Komprimierung fortfahren', + 'use hook decision if provided': + 'Hook-Entscheidung verwenden, falls bereitgestellt', + // Hooks - Messages + 'Config not loaded.': 'Konfiguration nicht geladen.', + 'Hooks are not enabled. Enable hooks in settings to use this feature.': + 'Hooks sind nicht aktiviert. Aktivieren Sie Hooks in den Einstellungen, um diese Funktion zu nutzen.', + 'No hooks configured. Add hooks in your settings.json file.': + 'Keine Hooks konfiguriert. Fügen Sie Hooks in Ihrer settings.json-Datei hinzu.', + 'Configured Hooks ({{count}} total)': + 'Konfigurierte Hooks ({{count}} insgesamt)', // ============================================================================ // Commands - Session Export @@ -708,7 +814,6 @@ export default { 'Workspace approval mode exists and takes priority. User-level change will have no effect.': 'Arbeitsbereich-Genehmigungsmodus existiert und hat Vorrang. Benutzerebene-Änderung hat keine Wirkung.', 'Apply To': 'Anwenden auf', - 'User Settings': 'Benutzereinstellungen', 'Workspace Settings': 'Arbeitsbereich-Einstellungen', // ============================================================================ @@ -763,7 +868,6 @@ export default { 'List configured MCP servers and tools': 'Konfigurierte MCP-Server und Werkzeuge auflisten', 'Restarts MCP servers.': 'MCP-Server neu starten.', - 'Config not loaded.': 'Konfiguration nicht geladen.', 'Could not retrieve tool registry.': 'Werkzeugregister konnte nicht abgerufen werden.', 'No MCP servers configured with OAuth authentication.': @@ -972,7 +1076,6 @@ export default { 'No server selected': 'Kein Server ausgewählt', '(disabled)': '(deaktiviert)', 'Error:': 'Fehler:', - Extension: 'Erweiterung', tool: 'Werkzeug', tools: 'Werkzeuge', connected: 'verbunden', diff --git a/packages/cli/src/i18n/locales/en.js b/packages/cli/src/i18n/locales/en.js index fb4433b2a..0a5f21536 100644 --- a/packages/cli/src/i18n/locales/en.js +++ b/packages/cli/src/i18n/locales/en.js @@ -668,6 +668,109 @@ export default { 'List all configured hooks': 'List all configured hooks', 'Enable a disabled hook': 'Enable a disabled hook', 'Disable an active hook': 'Disable an active hook', + // Hooks - Dialog + Hooks: 'Hooks', + 'Loading hooks...': 'Loading hooks...', + 'Error loading hooks:': 'Error loading hooks:', + 'Press Escape to close': 'Press Escape to close', + 'No hook selected': 'No hook selected', + // Hooks - List Step + 'No hook events found.': 'No hook events found.', + '{{count}} hook configured': '{{count}} hook configured', + '{{count}} hooks configured': '{{count}} hooks configured', + 'This menu is read-only. To add or modify hooks, edit settings.json directly or ask Qwen Code.': + 'This menu is read-only. To add or modify hooks, edit settings.json directly or ask Qwen Code.', + 'Enter to select · Esc to cancel': 'Enter to select · Esc to cancel', + // Hooks - Detail Step + 'Exit codes:': 'Exit codes:', + 'Configured hooks:': 'Configured hooks:', + 'No hooks configured for this event.': 'No hooks configured for this event.', + 'To add hooks, edit settings.json directly or ask Qwen.': + 'To add hooks, edit settings.json directly or ask Qwen.', + // Hooks - Source + Project: 'Project', + User: 'User', + System: 'System', + Extension: 'Extension', + 'Local Settings': 'Local Settings', + 'User Settings': 'User Settings', + 'System Settings': 'System Settings', + Extensions: 'Extensions', + // Hooks - Status + '✓ Enabled': '✓ Enabled', + '✗ Disabled': '✗ Disabled', + // Hooks - Event Descriptions (short) + 'Before tool execution': 'Before tool execution', + 'After tool execution': 'After tool execution', + 'After tool execution fails': 'After tool execution fails', + 'When notifications are sent': 'When notifications are sent', + 'When the user submits a prompt': 'When the user submits a prompt', + 'When a new session is started': 'When a new session is started', + 'Right before Qwen Code concludes its response': + 'Right before Qwen Code concludes its response', + 'When a subagent (Agent tool call) is started': + 'When a subagent (Agent tool call) is started', + 'Right before a subagent concludes its response': + 'Right before a subagent concludes its response', + 'Before conversation compaction': 'Before conversation compaction', + 'When a session is ending': 'When a session is ending', + 'When a permission dialog is displayed': + 'When a permission dialog is displayed', + // Hooks - Event Descriptions (detailed) + 'Input to command is JSON of tool call arguments.': + 'Input to command is JSON of tool call arguments.', + 'Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).': + 'Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).', + 'Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.': + 'Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.', + 'Input to command is JSON with notification message and type.': + 'Input to command is JSON with notification message and type.', + 'Input to command is JSON with original user prompt text.': + 'Input to command is JSON with original user prompt text.', + 'Input to command is JSON with session start source.': + 'Input to command is JSON with session start source.', + 'Input to command is JSON with session end reason.': + 'Input to command is JSON with session end reason.', + 'Input to command is JSON with agent_id and agent_type.': + 'Input to command is JSON with agent_id and agent_type.', + 'Input to command is JSON with agent_id, agent_type, and agent_transcript_path.': + 'Input to command is JSON with agent_id, agent_type, and agent_transcript_path.', + 'Input to command is JSON with compaction details.': + 'Input to command is JSON with compaction details.', + 'Input to command is JSON with tool_name, tool_input, and tool_use_id. Output JSON with hookSpecificOutput containing decision to allow or deny.': + 'Input to command is JSON with tool_name, tool_input, and tool_use_id. Output JSON with hookSpecificOutput containing decision to allow or deny.', + // Hooks - Exit Code Descriptions + 'stdout/stderr not shown': 'stdout/stderr not shown', + 'show stderr to model and continue conversation': + 'show stderr to model and continue conversation', + 'show stderr to user only': 'show stderr to user only', + 'stdout shown in transcript mode (ctrl+o)': + 'stdout shown in transcript mode (ctrl+o)', + 'show stderr to model immediately': 'show stderr to model immediately', + 'show stderr to user only but continue with tool call': + 'show stderr to user only but continue with tool call', + 'block processing, erase original prompt, and show stderr to user only': + 'block processing, erase original prompt, and show stderr to user only', + 'stdout shown to model': 'stdout shown to model', + 'show stderr to user only (blocking errors ignored)': + 'show stderr to user only (blocking errors ignored)', + 'command completes successfully': 'command completes successfully', + 'stdout shown to subagent': 'stdout shown to subagent', + 'show stderr to subagent and continue having it run': + 'show stderr to subagent and continue having it run', + 'stdout appended as custom compact instructions': + 'stdout appended as custom compact instructions', + 'block compaction': 'block compaction', + 'show stderr to user only but continue with compaction': + 'show stderr to user only but continue with compaction', + 'use hook decision if provided': 'use hook decision if provided', + // Hooks - Messages + 'Config not loaded.': 'Config not loaded.', + 'Hooks are not enabled. Enable hooks in settings to use this feature.': + 'Hooks are not enabled. Enable hooks in settings to use this feature.', + 'No hooks configured. Add hooks in your settings.json file.': + 'No hooks configured. Add hooks in your settings.json file.', + 'Configured Hooks ({{count}} total)': 'Configured Hooks ({{count}} total)', // ============================================================================ // Commands - Session Export @@ -775,7 +878,6 @@ export default { '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.', 'Apply To': 'Apply To', - 'User Settings': 'User Settings', 'Workspace Settings': 'Workspace Settings', // ============================================================================ @@ -829,7 +931,6 @@ export default { 'List configured MCP servers and tools', 'Restarts MCP servers.': 'Restarts MCP servers.', 'Open MCP management dialog': 'Open MCP management dialog', - 'Config not loaded.': 'Config not loaded.', 'Could not retrieve tool registry.': 'Could not retrieve tool registry.', 'No MCP servers configured with OAuth authentication.': 'No MCP servers configured with OAuth authentication.', @@ -895,7 +996,6 @@ export default { prompts: 'prompts', '(disabled)': '(disabled)', 'Error:': 'Error:', - Extension: 'Extension', tool: 'tool', tools: 'tools', connected: 'connected', diff --git a/packages/cli/src/i18n/locales/ja.js b/packages/cli/src/i18n/locales/ja.js index b06a6fdef..906867911 100644 --- a/packages/cli/src/i18n/locales/ja.js +++ b/packages/cli/src/i18n/locales/ja.js @@ -380,6 +380,109 @@ export default { 'List all configured hooks': '設定済みのフックをすべて表示する', 'Enable a disabled hook': '無効なフックを有効にする', 'Disable an active hook': '有効なフックを無効にする', + // Hooks - Dialog + Hooks: 'フック', + 'Loading hooks...': 'フックを読み込んでいます...', + 'Error loading hooks:': 'フックの読み込みエラー:', + 'Press Escape to close': 'Escape キーで閉じる', + 'No hook selected': 'フックが選択されていません', + // Hooks - List Step + 'No hook events found.': 'フックイベントが見つかりません。', + '{{count}} hook configured': '{{count}} 件のフックが設定されています', + '{{count}} hooks configured': '{{count}} 件のフックが設定されています', + 'This menu is read-only. To add or modify hooks, edit settings.json directly or ask Qwen Code.': + 'このメニューは読み取り専用です。フックを追加または変更するには、settings.json を直接編集するか、Qwen Code に尋ねてください。', + 'Enter to select · Esc to cancel': 'Enter で選択 · Esc でキャンセル', + // Hooks - Detail Step + 'Exit codes:': '終了コード:', + 'Configured hooks:': '設定済みのフック:', + 'No hooks configured for this event.': + 'このイベントにはフックが設定されていません。', + 'To add hooks, edit settings.json directly or ask Qwen.': + 'フックを追加するには、settings.json を直接編集するか、Qwen に尋ねてください。', + // Hooks - Source + Project: 'プロジェクト', + User: 'ユーザー', + System: 'システム', + Extension: '拡張機能', + 'Local Settings': 'ローカル設定', + 'User Settings': 'ユーザー設定', + 'System Settings': 'システム設定', + Extensions: '拡張機能', + // Hooks - Status + '✓ Enabled': '✓ 有効', + '✗ Disabled': '✗ 無効', + // Hooks - Event Descriptions (short) + 'Before tool execution': 'ツール実行前', + 'After tool execution': 'ツール実行後', + 'After tool execution fails': 'ツール実行失敗時', + 'When notifications are sent': '通知送信時', + 'When the user submits a prompt': 'ユーザーがプロンプトを送信した時', + 'When a new session is started': '新しいセッションが開始された時', + 'Right before Qwen Code concludes its response': + 'Qwen Code が応答を終了する直前', + 'When a subagent (Agent tool call) is started': + 'サブエージェント(Agent ツール呼び出し)が開始された時', + 'Right before a subagent concludes its response': + 'サブエージェントが応答を終了する直前', + 'Before conversation compaction': '会話圧縮前', + 'When a session is ending': 'セッション終了時', + 'When a permission dialog is displayed': '権限ダイアログ表示時', + // Hooks - Event Descriptions (detailed) + 'Input to command is JSON of tool call arguments.': + 'コマンドへの入力はツール呼び出し引数の JSON です。', + 'Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).': + 'コマンドへの入力は "inputs"(ツール呼び出し引数)と "response"(ツール呼び出し応答)フィールドを持つ JSON です。', + 'Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.': + 'コマンドへの入力は tool_name、tool_input、tool_use_id、error、error_type、is_interrupt、is_timeout を持つ JSON です。', + 'Input to command is JSON with notification message and type.': + 'コマンドへの入力は通知メッセージとタイプを持つ JSON です。', + 'Input to command is JSON with original user prompt text.': + 'コマンドへの入力は元のユーザープロンプトテキストを持つ JSON です。', + 'Input to command is JSON with session start source.': + 'コマンドへの入力はセッション開始ソースを持つ JSON です。', + 'Input to command is JSON with session end reason.': + 'コマンドへの入力はセッション終了理由を持つ JSON です。', + 'Input to command is JSON with agent_id and agent_type.': + 'コマンドへの入力は agent_id と agent_type を持つ JSON です。', + 'Input to command is JSON with agent_id, agent_type, and agent_transcript_path.': + 'コマンドへの入力は agent_id、agent_type、agent_transcript_path を持つ JSON です。', + 'Input to command is JSON with compaction details.': + 'コマンドへの入力は圧縮詳細を持つ JSON です。', + 'Input to command is JSON with tool_name, tool_input, and tool_use_id. Output JSON with hookSpecificOutput containing decision to allow or deny.': + 'コマンドへの入力は tool_name、tool_input、tool_use_id を持つ JSON です。許可または拒否の決定を含む hookSpecificOutput を持つ JSON を出力します。', + // Hooks - Exit Code Descriptions + 'stdout/stderr not shown': 'stdout/stderr は表示されません', + 'show stderr to model and continue conversation': + 'stderr をモデルに表示し、会話を続ける', + 'show stderr to user only': 'stderr をユーザーのみに表示', + 'stdout shown in transcript mode (ctrl+o)': + 'stdout はトランスクリプトモードで表示 (ctrl+o)', + 'show stderr to model immediately': 'stderr をモデルに即座に表示', + 'show stderr to user only but continue with tool call': + 'stderr をユーザーのみに表示し、ツール呼び出しを続ける', + 'block processing, erase original prompt, and show stderr to user only': + '処理をブロックし、元のプロンプトを消去し、stderr をユーザーのみに表示', + 'stdout shown to model': 'stdout をモデルに表示', + 'show stderr to user only (blocking errors ignored)': + 'stderr をユーザーのみに表示(ブロッキングエラーは無視)', + 'command completes successfully': 'コマンドが正常に完了', + 'stdout shown to subagent': 'stdout をサブエージェントに表示', + 'show stderr to subagent and continue having it run': + 'stderr をサブエージェントに表示し、実行を続ける', + 'stdout appended as custom compact instructions': + 'stdout をカスタム圧縮指示として追加', + 'block compaction': '圧縮をブロック', + 'show stderr to user only but continue with compaction': + 'stderr をユーザーのみに表示し、圧縮を続ける', + 'use hook decision if provided': '提供されている場合はフックの決定を使用', + // Hooks - Messages + 'Config not loaded.': '設定が読み込まれていません。', + 'Hooks are not enabled. Enable hooks in settings to use this feature.': + 'フックが有効になっていません。この機能を使用するには設定でフックを有効にしてください。', + 'No hooks configured. Add hooks in your settings.json file.': + 'フックが設定されていません。settings.json ファイルにフックを追加してください。', + 'Configured Hooks ({{count}} total)': '設定済みのフック(合計 {{count}} 件)', // ============================================================================ // Commands - Session Export @@ -480,7 +583,6 @@ export default { '(Use Enter to select, Tab to change focus)': '(Enter で選択、Tab でフォーカス変更)', 'Apply To': '適用先', - 'User Settings': 'ユーザー設定', 'Workspace Settings': 'ワークスペース設定', // Memory 'Commands for interacting with memory.': 'メモリ操作のコマンド', @@ -527,7 +629,6 @@ export default { '設定済みのMCPサーバーとツールを一覧表示', 'No MCP servers configured.': 'MCPサーバーが設定されていません', 'Restarts MCP servers.': 'MCPサーバーを再起動します', - 'Config not loaded.': '設定が読み込まれていません', 'Could not retrieve tool registry.': 'ツールレジストリを取得できませんでした', 'No MCP servers configured with OAuth authentication.': 'OAuth認証が設定されたMCPサーバーはありません', @@ -712,7 +813,6 @@ export default { 'No server selected': 'サーバーが選択されていません', '(disabled)': '(無効)', 'Error:': 'エラー:', - Extension: '拡張機能', tool: 'ツール', tools: 'ツール', connected: '接続済み', diff --git a/packages/cli/src/i18n/locales/pt.js b/packages/cli/src/i18n/locales/pt.js index b2240877b..c5110a2ce 100644 --- a/packages/cli/src/i18n/locales/pt.js +++ b/packages/cli/src/i18n/locales/pt.js @@ -599,6 +599,111 @@ export default { 'List all configured hooks': 'Listar todos os hooks configurados', 'Enable a disabled hook': 'Ativar um hook desativado', 'Disable an active hook': 'Desativar um hook ativo', + // Hooks - Dialog + Hooks: 'Hooks', + 'Loading hooks...': 'Carregando hooks...', + 'Error loading hooks:': 'Erro ao carregar hooks:', + 'Press Escape to close': 'Pressione Escape para fechar', + 'No hook selected': 'Nenhum hook selecionado', + // Hooks - List Step + 'No hook events found.': 'Nenhum evento de hook encontrado.', + '{{count}} hook configured': '{{count}} hook configurado', + '{{count}} hooks configured': '{{count}} hooks configurados', + 'This menu is read-only. To add or modify hooks, edit settings.json directly or ask Qwen Code.': + 'Este menu é somente leitura. Para adicionar ou modificar hooks, edite settings.json diretamente ou pergunte ao Qwen Code.', + 'Enter to select · Esc to cancel': + 'Enter para selecionar · Esc para cancelar', + // Hooks - Detail Step + 'Exit codes:': 'Códigos de saída:', + 'Configured hooks:': 'Hooks configurados:', + 'No hooks configured for this event.': + 'Nenhum hook configurado para este evento.', + 'To add hooks, edit settings.json directly or ask Qwen.': + 'Para adicionar hooks, edite settings.json diretamente ou pergunte ao Qwen.', + // Hooks - Source + Project: 'Projeto', + User: 'Usuário', + System: 'Sistema', + Extension: 'Extensão', + 'Local Settings': 'Configurações Locais', + 'User Settings': 'Configurações do Usuário', + 'System Settings': 'Configurações do Sistema', + Extensions: 'Extensões', + // Hooks - Status + '✓ Enabled': '✓ Ativado', + '✗ Disabled': '✗ Desativado', + // Hooks - Event Descriptions (short) + 'Before tool execution': 'Antes da execução da ferramenta', + 'After tool execution': 'Após a execução da ferramenta', + 'After tool execution fails': 'Após a falha da execução da ferramenta', + 'When notifications are sent': 'Quando notificações são enviadas', + 'When the user submits a prompt': 'Quando o usuário envia um prompt', + 'When a new session is started': 'Quando uma nova sessão é iniciada', + 'Right before Qwen Code concludes its response': + 'Logo antes do Qwen Code concluir sua resposta', + 'When a subagent (Agent tool call) is started': + 'Quando um subagente (chamada de ferramenta Agent) é iniciado', + 'Right before a subagent concludes its response': + 'Logo antes de um subagente concluir sua resposta', + 'Before conversation compaction': 'Antes da compactação da conversa', + 'When a session is ending': 'Quando uma sessão está terminando', + 'When a permission dialog is displayed': + 'Quando um diálogo de permissão é exibido', + // Hooks - Event Descriptions (detailed) + 'Input to command is JSON of tool call arguments.': + 'A entrada para o comando é JSON dos argumentos da chamada da ferramenta.', + 'Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).': + 'A entrada para o comando é JSON com campos "inputs" (argumentos da chamada da ferramenta) e "response" (resposta da chamada da ferramenta).', + 'Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.': + 'A entrada para o comando é JSON com tool_name, tool_input, tool_use_id, error, error_type, is_interrupt e is_timeout.', + 'Input to command is JSON with notification message and type.': + 'A entrada para o comando é JSON com mensagem e tipo de notificação.', + 'Input to command is JSON with original user prompt text.': + 'A entrada para o comando é JSON com o texto original do prompt do usuário.', + 'Input to command is JSON with session start source.': + 'A entrada para o comando é JSON com a fonte de início da sessão.', + 'Input to command is JSON with session end reason.': + 'A entrada para o comando é JSON com o motivo do fim da sessão.', + 'Input to command is JSON with agent_id and agent_type.': + 'A entrada para o comando é JSON com agent_id e agent_type.', + 'Input to command is JSON with agent_id, agent_type, and agent_transcript_path.': + 'A entrada para o comando é JSON com agent_id, agent_type e agent_transcript_path.', + 'Input to command is JSON with compaction details.': + 'A entrada para o comando é JSON com detalhes da compactação.', + 'Input to command is JSON with tool_name, tool_input, and tool_use_id. Output JSON with hookSpecificOutput containing decision to allow or deny.': + 'A entrada para o comando é JSON com tool_name, tool_input e tool_use_id. Saída é JSON com hookSpecificOutput contendo decisão de permitir ou negar.', + // Hooks - Exit Code Descriptions + 'stdout/stderr not shown': 'stdout/stderr não exibido', + 'show stderr to model and continue conversation': + 'mostrar stderr ao modelo e continuar conversa', + 'show stderr to user only': 'mostrar stderr apenas ao usuário', + 'stdout shown in transcript mode (ctrl+o)': + 'stdout exibido no modo transcrição (ctrl+o)', + 'show stderr to model immediately': 'mostrar stderr ao modelo imediatamente', + 'show stderr to user only but continue with tool call': + 'mostrar stderr apenas ao usuário mas continuar com chamada de ferramenta', + 'block processing, erase original prompt, and show stderr to user only': + 'bloquear processamento, apagar prompt original e mostrar stderr apenas ao usuário', + 'stdout shown to model': 'stdout mostrado ao modelo', + 'show stderr to user only (blocking errors ignored)': + 'mostrar stderr apenas ao usuário (erros de bloqueio ignorados)', + 'command completes successfully': 'comando concluído com sucesso', + 'stdout shown to subagent': 'stdout mostrado ao subagente', + 'show stderr to subagent and continue having it run': + 'mostrar stderr ao subagente e continuar executando', + 'stdout appended as custom compact instructions': + 'stdout anexado como instruções de compactação personalizadas', + 'block compaction': 'bloquear compactação', + 'show stderr to user only but continue with compaction': + 'mostrar stderr apenas ao usuário mas continuar com compactação', + 'use hook decision if provided': 'usar decisão do hook se fornecida', + // Hooks - Messages + 'Config not loaded.': 'Configuração não carregada.', + 'Hooks are not enabled. Enable hooks in settings to use this feature.': + 'Hooks não estão ativados. Ative hooks nas configurações para usar este recurso.', + 'No hooks configured. Add hooks in your settings.json file.': + 'Nenhum hook configurado. Adicione hooks no seu arquivo settings.json.', + 'Configured Hooks ({{count}} total)': 'Hooks Configurados ({{count}} total)', // ============================================================================ // Commands - Session Export @@ -712,7 +817,6 @@ export default { 'Workspace approval mode exists and takes priority. User-level change will have no effect.': 'O modo de aprovação do workspace existe e tem prioridade. A alteração no nível do usuário não terá efeito.', 'Apply To': 'Aplicar A', - 'User Settings': 'Configurações do Usuário', 'Workspace Settings': 'Configurações do Workspace', // ============================================================================ @@ -769,7 +873,6 @@ export default { 'List configured MCP servers and tools': 'Listar servidores e ferramentas MCP configurados', 'Restarts MCP servers.': 'Reinicia os servidores MCP.', - 'Config not loaded.': 'Configuração não carregada.', 'Could not retrieve tool registry.': 'Não foi possível recuperar o registro de ferramentas.', 'No MCP servers configured with OAuth authentication.': @@ -979,7 +1082,6 @@ export default { 'No server selected': 'Nenhum servidor selecionado', '(disabled)': '(desativado)', 'Error:': 'Erro:', - Extension: 'Extensão', tool: 'ferramenta', tools: 'ferramentas', connected: 'conectado', diff --git a/packages/cli/src/i18n/locales/ru.js b/packages/cli/src/i18n/locales/ru.js index c3ae5953a..f7a137f5d 100644 --- a/packages/cli/src/i18n/locales/ru.js +++ b/packages/cli/src/i18n/locales/ru.js @@ -605,6 +605,110 @@ export default { 'List all configured hooks': 'Показать все настроенные хуки', 'Enable a disabled hook': 'Включить отключенный хук', 'Disable an active hook': 'Отключить активный хук', + // Hooks - Dialog + Hooks: 'Хуки', + 'Loading hooks...': 'Загрузка хуков...', + 'Error loading hooks:': 'Ошибка загрузки хуков:', + 'Press Escape to close': 'Нажмите Escape для закрытия', + 'No hook selected': 'Хук не выбран', + // Hooks - List Step + 'No hook events found.': 'События хуков не найдены.', + '{{count}} hook configured': '{{count}} хук настроен', + '{{count}} hooks configured': '{{count}} хуков настроено', + 'This menu is read-only. To add or modify hooks, edit settings.json directly or ask Qwen Code.': + 'Это меню только для чтения. Чтобы добавить или изменить хуки, отредактируйте settings.json напрямую или спросите Qwen Code.', + 'Enter to select · Esc to cancel': 'Enter для выбора · Esc для отмены', + // Hooks - Detail Step + 'Exit codes:': 'Коды выхода:', + 'Configured hooks:': 'Настроенные хуки:', + 'No hooks configured for this event.': + 'Для этого события нет настроенных хуков.', + 'To add hooks, edit settings.json directly or ask Qwen.': + 'Чтобы добавить хуки, отредактируйте settings.json напрямую или спросите Qwen.', + // Hooks - Source + Project: 'Проект', + User: 'Пользователь', + System: 'Система', + Extension: 'Расширение', + 'Local Settings': 'Локальные настройки', + 'User Settings': 'Пользовательские настройки', + 'System Settings': 'Системные настройки', + Extensions: 'Расширения', + // Hooks - Status + '✓ Enabled': '✓ Включен', + '✗ Disabled': '✗ Отключен', + // Hooks - Event Descriptions (short) + 'Before tool execution': 'Перед выполнением инструмента', + 'After tool execution': 'После выполнения инструмента', + 'After tool execution fails': 'При неудачном выполнении инструмента', + 'When notifications are sent': 'При отправке уведомлений', + 'When the user submits a prompt': 'Когда пользователь отправляет промпт', + 'When a new session is started': 'При запуске новой сессии', + 'Right before Qwen Code concludes its response': + 'Непосредственно перед завершением ответа Qwen Code', + 'When a subagent (Agent tool call) is started': + 'При запуске субагента (вызов инструмента Agent)', + 'Right before a subagent concludes its response': + 'Непосредственно перед завершением ответа субагента', + 'Before conversation compaction': 'Перед сжатием разговора', + 'When a session is ending': 'При завершении сессии', + 'When a permission dialog is displayed': 'При отображении диалога разрешений', + // Hooks - Event Descriptions (detailed) + 'Input to command is JSON of tool call arguments.': + 'Ввод в команду — это JSON аргументов вызова инструмента.', + 'Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).': + 'Ввод в команду — это JSON с полями "inputs" (аргументы вызова инструмента) и "response" (ответ вызова инструмента).', + 'Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.': + 'Ввод в команду — это JSON с tool_name, tool_input, tool_use_id, error, error_type, is_interrupt и is_timeout.', + 'Input to command is JSON with notification message and type.': + 'Ввод в команду — это JSON с сообщением уведомления и типом.', + 'Input to command is JSON with original user prompt text.': + 'Ввод в команду — это JSON с исходным текстом промпта пользователя.', + 'Input to command is JSON with session start source.': + 'Ввод в команду — это JSON с источником запуска сессии.', + 'Input to command is JSON with session end reason.': + 'Ввод в команду — это JSON с причиной завершения сессии.', + 'Input to command is JSON with agent_id and agent_type.': + 'Ввод в команду — это JSON с agent_id и agent_type.', + 'Input to command is JSON with agent_id, agent_type, and agent_transcript_path.': + 'Ввод в команду — это JSON с agent_id, agent_type и agent_transcript_path.', + 'Input to command is JSON with compaction details.': + 'Ввод в команду — это JSON с деталями сжатия.', + 'Input to command is JSON with tool_name, tool_input, and tool_use_id. Output JSON with hookSpecificOutput containing decision to allow or deny.': + 'Ввод в команду — это JSON с tool_name, tool_input и tool_use_id. Вывод — JSON с hookSpecificOutput, содержащим решение о разрешении или отказе.', + // Hooks - Exit Code Descriptions + 'stdout/stderr not shown': 'stdout/stderr не отображаются', + 'show stderr to model and continue conversation': + 'показать stderr модели и продолжить разговор', + 'show stderr to user only': 'показать stderr только пользователю', + 'stdout shown in transcript mode (ctrl+o)': + 'stdout отображается в режиме транскрипции (ctrl+o)', + 'show stderr to model immediately': 'показать stderr модели немедленно', + 'show stderr to user only but continue with tool call': + 'показать stderr только пользователю, но продолжить вызов инструмента', + 'block processing, erase original prompt, and show stderr to user only': + 'заблокировать обработку, стереть исходный промпт и показать stderr только пользователю', + 'stdout shown to model': 'stdout показан модели', + 'show stderr to user only (blocking errors ignored)': + 'показать stderr только пользователю (блокирующие ошибки игнорируются)', + 'command completes successfully': 'команда успешно завершена', + 'stdout shown to subagent': 'stdout показан субагенту', + 'show stderr to subagent and continue having it run': + 'показать stderr субагенту и продолжить его выполнение', + 'stdout appended as custom compact instructions': + 'stdout добавлен как пользовательские инструкции сжатия', + 'block compaction': 'заблокировать сжатие', + 'show stderr to user only but continue with compaction': + 'показать stderr только пользователю, но продолжить сжатие', + 'use hook decision if provided': + 'использовать решение хука, если предоставлено', + // Hooks - Messages + 'Config not loaded.': 'Конфигурация не загружена.', + 'Hooks are not enabled. Enable hooks in settings to use this feature.': + 'Хуки не включены. Включите хуки в настройках, чтобы использовать эту функцию.', + 'No hooks configured. Add hooks in your settings.json file.': + 'Хуки не настроены. Добавьте хуки в файл settings.json.', + 'Configured Hooks ({{count}} total)': 'Настроенные хуки (всего {{count}})', // ============================================================================ // Commands - Session Export @@ -718,7 +822,6 @@ export default { 'Workspace approval mode exists and takes priority. User-level change will have no effect.': 'Режим подтверждения рабочего пространства существует и имеет приоритет. Изменение на уровне пользователя не будет иметь эффекта.', 'Apply To': 'Применить к', - 'User Settings': 'Настройки пользователя', 'Workspace Settings': 'Настройки рабочего пространства', // ============================================================================ @@ -773,7 +876,6 @@ export default { 'List configured MCP servers and tools': 'Просмотр настроенных MCP-серверов и инструментов', 'Restarts MCP servers.': 'Перезапустить MCP-серверы.', - 'Config not loaded.': 'Конфигурация не загружена.', 'Could not retrieve tool registry.': 'Не удалось получить реестр инструментов.', 'No MCP servers configured with OAuth authentication.': @@ -951,7 +1053,6 @@ export default { 'View tools': 'Просмотреть инструменты', '(disabled)': '(отключен)', 'Error:': 'Ошибка:', - Extension: 'Расширение', tool: 'инструмент', connected: 'подключен', connecting: 'подключение', diff --git a/packages/cli/src/i18n/locales/zh.js b/packages/cli/src/i18n/locales/zh.js index d22fe9b26..371e98b40 100644 --- a/packages/cli/src/i18n/locales/zh.js +++ b/packages/cli/src/i18n/locales/zh.js @@ -632,6 +632,105 @@ export default { 'List all configured hooks': '列出所有已配置的 Hook', 'Enable a disabled hook': '启用已禁用的 Hook', 'Disable an active hook': '禁用已启用的 Hook', + // Hooks - Dialog + Hooks: 'Hook', + 'Loading hooks...': '正在加载 Hook...', + 'Error loading hooks:': '加载 Hook 出错:', + 'Press Escape to close': '按 Escape 关闭', + 'No hook selected': '未选择 Hook', + // Hooks - List Step + 'No hook events found.': '未找到 Hook 事件。', + '{{count}} hook configured': '{{count}} 个 Hook 已配置', + '{{count}} hooks configured': '{{count}} 个 Hook 已配置', + 'This menu is read-only. To add or modify hooks, edit settings.json directly or ask Qwen Code.': + '此菜单为只读。要添加或修改 Hook,请直接编辑 settings.json 或询问 Qwen Code。', + 'Enter to select · Esc to cancel': 'Enter 选择 · Esc 取消', + // Hooks - Detail Step + 'Exit codes:': '退出码:', + 'Configured hooks:': '已配置的 Hook:', + 'No hooks configured for this event.': '此事件未配置 Hook。', + 'To add hooks, edit settings.json directly or ask Qwen.': + '要添加 Hook,请直接编辑 settings.json 或询问 Qwen。', + // Hooks - Source + Project: '项目', + User: '用户', + System: '系统', + Extension: '扩展', + 'Local Settings': '本地设置', + 'User Settings': '用户设置', + 'System Settings': '系统设置', + Extensions: '扩展', + // Hooks - Status + '✓ Enabled': '✓ 已启用', + '✗ Disabled': '✗ 已禁用', + // Hooks - Event Descriptions (short) + 'Before tool execution': '工具执行前', + 'After tool execution': '工具执行后', + 'After tool execution fails': '工具执行失败后', + 'When notifications are sent': '发送通知时', + 'When the user submits a prompt': '用户提交提示时', + 'When a new session is started': '新会话开始时', + 'Right before Qwen Code concludes its response': 'Qwen Code 结束响应之前', + 'When a subagent (Agent tool call) is started': + '子智能体(Agent 工具调用)启动时', + 'Right before a subagent concludes its response': '子智能体结束响应之前', + 'Before conversation compaction': '对话压缩前', + 'When a session is ending': '会话结束时', + 'When a permission dialog is displayed': '显示权限对话框时', + // Hooks - Event Descriptions (detailed) + 'Input to command is JSON of tool call arguments.': + '命令输入为工具调用参数的 JSON。', + 'Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).': + '命令输入为包含 "inputs"(工具调用参数)和 "response"(工具调用响应)字段的 JSON。', + 'Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.': + '命令输入为包含 tool_name、tool_input、tool_use_id、error、error_type、is_interrupt 和 is_timeout 的 JSON。', + 'Input to command is JSON with notification message and type.': + '命令输入为包含通知消息和类型的 JSON。', + 'Input to command is JSON with original user prompt text.': + '命令输入为包含原始用户提示文本的 JSON。', + 'Input to command is JSON with session start source.': + '命令输入为包含会话启动来源的 JSON。', + 'Input to command is JSON with session end reason.': + '命令输入为包含会话结束原因的 JSON。', + 'Input to command is JSON with agent_id and agent_type.': + '命令输入为包含 agent_id 和 agent_type 的 JSON。', + 'Input to command is JSON with agent_id, agent_type, and agent_transcript_path.': + '命令输入为包含 agent_id、agent_type 和 agent_transcript_path 的 JSON。', + 'Input to command is JSON with compaction details.': + '命令输入为包含压缩详情的 JSON。', + 'Input to command is JSON with tool_name, tool_input, and tool_use_id. Output JSON with hookSpecificOutput containing decision to allow or deny.': + '命令输入为包含 tool_name、tool_input 和 tool_use_id 的 JSON。输出包含 hookSpecificOutput 的 JSON,其中包含允许或拒绝的决定。', + // Hooks - Exit Code Descriptions + 'stdout/stderr not shown': 'stdout/stderr 不显示', + 'show stderr to model and continue conversation': + '向模型显示 stderr 并继续对话', + 'show stderr to user only': '仅向用户显示 stderr', + 'stdout shown in transcript mode (ctrl+o)': 'stdout 以转录模式显示 (ctrl+o)', + 'show stderr to model immediately': '立即向模型显示 stderr', + 'show stderr to user only but continue with tool call': + '仅向用户显示 stderr 但继续工具调用', + 'block processing, erase original prompt, and show stderr to user only': + '阻止处理,擦除原始提示,仅向用户显示 stderr', + 'stdout shown to model': '向模型显示 stdout', + 'show stderr to user only (blocking errors ignored)': + '仅向用户显示 stderr(忽略阻塞错误)', + 'command completes successfully': '命令成功完成', + 'stdout shown to subagent': '向子智能体显示 stdout', + 'show stderr to subagent and continue having it run': + '向子智能体显示 stderr 并继续运行', + 'stdout appended as custom compact instructions': + 'stdout 作为自定义压缩指令追加', + 'block compaction': '阻止压缩', + 'show stderr to user only but continue with compaction': + '仅向用户显示 stderr 但继续压缩', + 'use hook decision if provided': '如果提供则使用 Hook 决定', + // Hooks - Messages + 'Config not loaded.': '配置未加载。', + 'Hooks are not enabled. Enable hooks in settings to use this feature.': + 'Hook 未启用。请在设置中启用 Hook 以使用此功能。', + 'No hooks configured. Add hooks in your settings.json file.': + '未配置 Hook。请在 settings.json 文件中添加 Hook。', + 'Configured Hooks ({{count}} total)': '已配置的 Hook(共 {{count}} 个)', // ============================================================================ // Commands - Session Export @@ -732,7 +831,6 @@ export default { 'Workspace approval mode exists and takes priority. User-level change will have no effect.': '工作区审批模式已存在并具有优先级。用户级别的更改将无效。', 'Apply To': '应用于', - 'User Settings': '用户设置', 'Workspace Settings': '工作区设置', // ============================================================================ @@ -782,7 +880,6 @@ export default { 'List configured MCP servers and tools': '列出已配置的 MCP 服务器和工具', 'Restarts MCP servers.': '重启 MCP 服务器', 'Open MCP management dialog': '打开 MCP 管理对话框', - 'Config not loaded.': '配置未加载', 'Could not retrieve tool registry.': '无法检索工具注册表', 'No MCP servers configured with OAuth authentication.': '未配置支持 OAuth 认证的 MCP 服务器', @@ -841,7 +938,6 @@ export default { 'Server:': '服务器:', '(disabled)': '(已禁用)', 'Error:': '错误:', - Extension: '扩展', tool: '工具', tools: '个工具', connected: '已连接', diff --git a/packages/cli/src/ui/commands/hooksCommand.ts b/packages/cli/src/ui/commands/hooksCommand.ts index 60b2b1b6d..2a007dfeb 100644 --- a/packages/cli/src/ui/commands/hooksCommand.ts +++ b/packages/cli/src/ui/commands/hooksCommand.ts @@ -20,13 +20,13 @@ import type { HookRegistryEntry } from '@qwen-code/qwen-code-core'; function formatHookSource(source: string): string { switch (source) { case 'project': - return 'Project'; + return t('Project'); case 'user': - return 'User'; + return t('User'); case 'system': - return 'System'; + return t('System'); case 'extensions': - return 'Extension'; + return t('Extension'); default: return source; } @@ -36,7 +36,7 @@ function formatHookSource(source: string): string { * Format hook status for display */ function formatHookStatus(enabled: boolean): string { - return enabled ? '✓ Enabled' : '✗ Disabled'; + return enabled ? t('✓ Enabled') : t('✗ Disabled'); } const listCommand: SlashCommand = { diff --git a/packages/cli/src/ui/components/hooks/HookDetailStep.tsx b/packages/cli/src/ui/components/hooks/HookDetailStep.tsx index b0be97664..d5078eb31 100644 --- a/packages/cli/src/ui/components/hooks/HookDetailStep.tsx +++ b/packages/cli/src/ui/components/hooks/HookDetailStep.tsx @@ -9,7 +9,8 @@ import { Box, Text } from 'ink'; import { theme } from '../../semantic-colors.js'; import { useKeypress } from '../../hooks/useKeypress.js'; import type { HookEventDisplayInfo } from './types.js'; -import { SOURCE_DISPLAY_MAP } from './constants.js'; +import { getTranslatedSourceDisplayMap } from './constants.js'; +import { t } from '../../../i18n/index.js'; interface HookDetailStepProps { hook: HookEventDisplayInfo; @@ -23,6 +24,9 @@ export function HookDetailStep({ const hasConfigs = hook.configs.length > 0; const [selectedIndex, setSelectedIndex] = useState(0); + // Get translated source display map + const sourceDisplayMap = getTranslatedSourceDisplayMap(); + // Handle keyboard navigation useKeypress( (key) => { @@ -61,7 +65,7 @@ export function HookDetailStep({ {hook.exitCodes.length > 0 && ( - Exit codes: + {t('Exit codes:')} {hook.exitCodes.map((ec, index) => ( @@ -79,12 +83,12 @@ export function HookDetailStep({ {hasConfigs ? ( <> - Configured hooks: + {t('Configured hooks:')} {hook.configs.map((config, index) => { const isSelected = index === selectedIndex; const sourceDisplay = - SOURCE_DISPLAY_MAP[config.source] || config.source; + sourceDisplayMap[config.source] || config.source; return ( @@ -107,23 +111,23 @@ export function HookDetailStep({ ); })} - Esc to go back + {t('Esc to go back')} ) : ( <> - No hooks configured for this event. + {t('No hooks configured for this event.')} - To add hooks, edit settings.json directly or ask Qwen. + {t('To add hooks, edit settings.json directly or ask Qwen.')} - Esc to go back + {t('Esc to go back')} )} diff --git a/packages/cli/src/ui/components/hooks/HooksListStep.tsx b/packages/cli/src/ui/components/hooks/HooksListStep.tsx index 7cdab9035..3058dd14d 100644 --- a/packages/cli/src/ui/components/hooks/HooksListStep.tsx +++ b/packages/cli/src/ui/components/hooks/HooksListStep.tsx @@ -9,6 +9,7 @@ import { Box, Text } from 'ink'; import { theme } from '../../semantic-colors.js'; import { useKeypress } from '../../hooks/useKeypress.js'; import type { HookEventDisplayInfo } from './types.js'; +import { t } from '../../../i18n/index.js'; interface HooksListStepProps { hooks: HookEventDisplayInfo[]; @@ -41,7 +42,7 @@ export function HooksListStep({ if (hooks.length === 0) { return ( - No hook events found. + {t('No hook events found.')} ); } @@ -52,21 +53,26 @@ export function HooksListStep({ 0, ); + // Get the correct plural/singular form + const hooksConfiguredText = + totalConfigured === 1 + ? t('{{count}} hook configured', { count: String(totalConfigured) }) + : t('{{count}} hooks configured', { count: String(totalConfigured) }); + return ( - Hooks - - - {` · ${totalConfigured} hook${totalConfigured !== 1 ? 's' : ''} configured`} + {t('Hooks')} + {` · ${hooksConfiguredText}`} - This menu is read-only. To add or modify hooks, edit settings.json - directly or ask Qwen Code. + {t( + 'This menu is read-only. To add or modify hooks, edit settings.json directly or ask Qwen Code.', + )} @@ -101,7 +107,7 @@ export function HooksListStep({ - Enter to select · Esc to cancel + {t('Enter to select · Esc to cancel')} diff --git a/packages/cli/src/ui/components/hooks/HooksManagementDialog.tsx b/packages/cli/src/ui/components/hooks/HooksManagementDialog.tsx index dc7ab6e85..25e9b84a6 100644 --- a/packages/cli/src/ui/components/hooks/HooksManagementDialog.tsx +++ b/packages/cli/src/ui/components/hooks/HooksManagementDialog.tsx @@ -25,9 +25,10 @@ import { HooksListStep } from './HooksListStep.js'; import { HookDetailStep } from './HookDetailStep.js'; import { DISPLAY_HOOK_EVENTS, - SOURCE_DISPLAY_MAP, + getTranslatedSourceDisplayMap, createEmptyHookEventInfo, } from './constants.js'; +import { t } from '../../../i18n/index.js'; const debugLogger = createDebugLogger('HOOKS_DIALOG'); @@ -44,6 +45,7 @@ export function HooksManagementDialog({ const [selectedHookIndex, setSelectedHookIndex] = useState(-1); const [hooks, setHooks] = useState([]); const [isLoading, setIsLoading] = useState(true); + const [loadError, setLoadError] = useState(null); // Load hooks data const fetchHooksData = useCallback((): HookEventDisplayInfo[] => { @@ -55,6 +57,9 @@ export function HooksManagementDialog({ SettingScope.Workspace, ).settings; + // Get translated source display map + const sourceDisplayMap = getTranslatedSourceDisplayMap(); + const result: HookEventDisplayInfo[] = []; for (const eventName of DISPLAY_HOOK_EVENTS) { @@ -70,7 +75,7 @@ export function HooksManagementDialog({ hookInfo.configs.push({ config: hookConfig, source: HooksConfigSource.User, - sourceDisplay: SOURCE_DISPLAY_MAP[HooksConfigSource.User], + sourceDisplay: sourceDisplayMap[HooksConfigSource.User], enabled: true, }); } @@ -87,7 +92,7 @@ export function HooksManagementDialog({ hookInfo.configs.push({ config: hookConfig, source: HooksConfigSource.Project, - sourceDisplay: SOURCE_DISPLAY_MAP[HooksConfigSource.Project], + sourceDisplay: sourceDisplayMap[HooksConfigSource.Project], enabled: true, }); } @@ -103,7 +108,7 @@ export function HooksManagementDialog({ hookInfo.configs.push({ config: hookConfig, source: HooksConfigSource.Extensions, - sourceDisplay: SOURCE_DISPLAY_MAP[HooksConfigSource.Extensions], + sourceDisplay: sourceDisplayMap[HooksConfigSource.Extensions], enabled: true, }); } @@ -120,11 +125,15 @@ export function HooksManagementDialog({ // Load hooks data on initial render useEffect(() => { setIsLoading(true); + setLoadError(null); try { const hooksData = fetchHooksData(); setHooks(hooksData); } catch (error) { debugLogger.error('Error loading hooks:', error); + setLoadError( + error instanceof Error ? error.message : 'Failed to load hooks', + ); } finally { setIsLoading(false); } @@ -180,7 +189,21 @@ export function HooksManagementDialog({ if (isLoading) { return ( - Loading hooks... + {t('Loading hooks...')} + + ); + } + + if (loadError) { + return ( + + {t('Error loading hooks:')} + {loadError} + + + {t('Press Escape to close')} + + ); } @@ -203,7 +226,7 @@ export function HooksManagementDialog({ } return ( - No hook selected + {t('No hook selected')} ); diff --git a/packages/cli/src/ui/components/hooks/constants.ts b/packages/cli/src/ui/components/hooks/constants.ts index 7fe4833ea..5ecaa4bc4 100644 --- a/packages/cli/src/ui/components/hooks/constants.ts +++ b/packages/cli/src/ui/components/hooks/constants.ts @@ -6,144 +6,182 @@ import { HooksConfigSource, HookEventName } from '@qwen-code/qwen-code-core'; import type { HookExitCode, HookEventDisplayInfo } from './types.js'; +import { t } from '../../../i18n/index.js'; /** * Exit code descriptions for different hook types */ -export const HOOK_EXIT_CODES: Record = { - [HookEventName.Stop]: [ - { code: 0, description: 'stdout/stderr not shown' }, - { code: 2, description: 'show stderr to model and continue conversation' }, - { code: 'Other', description: 'show stderr to user only' }, - ], - [HookEventName.PreToolUse]: [ - { code: 0, description: 'stdout/stderr not shown' }, - { code: 2, description: 'show stderr to model and block tool call' }, - { - code: 'Other', - description: 'show stderr to user only but continue with tool call', - }, - ], - [HookEventName.PostToolUse]: [ - { code: 0, description: 'stdout shown in transcript mode (ctrl+o)' }, - { code: 2, description: 'show stderr to model immediately' }, - { code: 'Other', description: 'show stderr to user only' }, - ], - [HookEventName.PostToolUseFailure]: [ - { code: 0, description: 'stdout shown in transcript mode (ctrl+o)' }, - { code: 2, description: 'show stderr to model immediately' }, - { code: 'Other', description: 'show stderr to user only' }, - ], - [HookEventName.Notification]: [ - { code: 0, description: 'stdout/stderr not shown' }, - { code: 'Other', description: 'show stderr to user only' }, - ], - [HookEventName.UserPromptSubmit]: [ - { code: 0, description: 'stdout shown to model' }, - { - code: 2, - description: - 'block processing, erase original prompt, and show stderr to user only', - }, - { code: 'Other', description: 'show stderr to user only' }, - ], - [HookEventName.SessionStart]: [ - { code: 0, description: 'stdout shown to model' }, - { - code: 'Other', - description: 'show stderr to user only (blocking errors ignored)', - }, - ], - [HookEventName.SessionEnd]: [ - { code: 0, description: 'command completes successfully' }, - { code: 'Other', description: 'show stderr to user only' }, - ], - [HookEventName.SubagentStart]: [ - { code: 0, description: 'stdout shown to subagent' }, - { - code: 'Other', - description: 'show stderr to user only (blocking errors ignored)', - }, - ], - [HookEventName.SubagentStop]: [ - { code: 0, description: 'stdout/stderr not shown' }, - { - code: 2, - description: 'show stderr to subagent and continue having it run', - }, - { code: 'Other', description: 'show stderr to user only' }, - ], - [HookEventName.PreCompact]: [ - { code: 0, description: 'stdout appended as custom compact instructions' }, - { code: 2, description: 'block compaction' }, - { - code: 'Other', - description: 'show stderr to user only but continue with compaction', - }, - ], - [HookEventName.PermissionRequest]: [ - { code: 0, description: 'use hook decision if provided' }, - { code: 'Other', description: 'show stderr to user only' }, - ], -}; +export function getHookExitCodes(eventName: string): HookExitCode[] { + const exitCodesMap: Record = { + [HookEventName.Stop]: [ + { code: 0, description: t('stdout/stderr not shown') }, + { + code: 2, + description: t('show stderr to model and continue conversation'), + }, + { code: 'Other', description: t('show stderr to user only') }, + ], + [HookEventName.PreToolUse]: [ + { code: 0, description: t('stdout/stderr not shown') }, + { code: 2, description: t('show stderr to model and block tool call') }, + { + code: 'Other', + description: t('show stderr to user only but continue with tool call'), + }, + ], + [HookEventName.PostToolUse]: [ + { code: 0, description: t('stdout shown in transcript mode (ctrl+o)') }, + { code: 2, description: t('show stderr to model immediately') }, + { code: 'Other', description: t('show stderr to user only') }, + ], + [HookEventName.PostToolUseFailure]: [ + { code: 0, description: t('stdout shown in transcript mode (ctrl+o)') }, + { code: 2, description: t('show stderr to model immediately') }, + { code: 'Other', description: t('show stderr to user only') }, + ], + [HookEventName.Notification]: [ + { code: 0, description: t('stdout/stderr not shown') }, + { code: 'Other', description: t('show stderr to user only') }, + ], + [HookEventName.UserPromptSubmit]: [ + { code: 0, description: t('stdout shown to model') }, + { + code: 2, + description: t( + 'block processing, erase original prompt, and show stderr to user only', + ), + }, + { code: 'Other', description: t('show stderr to user only') }, + ], + [HookEventName.SessionStart]: [ + { code: 0, description: t('stdout shown to model') }, + { + code: 'Other', + description: t('show stderr to user only (blocking errors ignored)'), + }, + ], + [HookEventName.SessionEnd]: [ + { code: 0, description: t('command completes successfully') }, + { code: 'Other', description: t('show stderr to user only') }, + ], + [HookEventName.SubagentStart]: [ + { code: 0, description: t('stdout shown to subagent') }, + { + code: 'Other', + description: t('show stderr to user only (blocking errors ignored)'), + }, + ], + [HookEventName.SubagentStop]: [ + { code: 0, description: t('stdout/stderr not shown') }, + { + code: 2, + description: t('show stderr to subagent and continue having it run'), + }, + { code: 'Other', description: t('show stderr to user only') }, + ], + [HookEventName.PreCompact]: [ + { + code: 0, + description: t('stdout appended as custom compact instructions'), + }, + { code: 2, description: t('block compaction') }, + { + code: 'Other', + description: t('show stderr to user only but continue with compaction'), + }, + ], + [HookEventName.PermissionRequest]: [ + { code: 0, description: t('use hook decision if provided') }, + { code: 'Other', description: t('show stderr to user only') }, + ], + }; + return exitCodesMap[eventName] || []; +} /** * Short one-line description for hooks list view */ -export const HOOK_SHORT_DESCRIPTIONS: Record = { - [HookEventName.PreToolUse]: 'Before tool execution', - [HookEventName.PostToolUse]: 'After tool execution', - [HookEventName.PostToolUseFailure]: 'After tool execution fails', - [HookEventName.Notification]: 'When notifications are sent', - [HookEventName.UserPromptSubmit]: 'When the user submits a prompt', - [HookEventName.SessionStart]: 'When a new session is started', - [HookEventName.Stop]: 'Right before Qwen Code concludes its response', - [HookEventName.SubagentStart]: 'When a subagent (Agent tool call) is started', - [HookEventName.SubagentStop]: - 'Right before a subagent concludes its response', - [HookEventName.PreCompact]: 'Before conversation compaction', - [HookEventName.SessionEnd]: 'When a session is ending', - [HookEventName.PermissionRequest]: 'When a permission dialog is displayed', -}; +export function getHookShortDescription(eventName: string): string { + const descriptions: Record = { + [HookEventName.PreToolUse]: t('Before tool execution'), + [HookEventName.PostToolUse]: t('After tool execution'), + [HookEventName.PostToolUseFailure]: t('After tool execution fails'), + [HookEventName.Notification]: t('When notifications are sent'), + [HookEventName.UserPromptSubmit]: t('When the user submits a prompt'), + [HookEventName.SessionStart]: t('When a new session is started'), + [HookEventName.Stop]: t('Right before Qwen Code concludes its response'), + [HookEventName.SubagentStart]: t( + 'When a subagent (Agent tool call) is started', + ), + [HookEventName.SubagentStop]: t( + 'Right before a subagent concludes its response', + ), + [HookEventName.PreCompact]: t('Before conversation compaction'), + [HookEventName.SessionEnd]: t('When a session is ending'), + [HookEventName.PermissionRequest]: t( + 'When a permission dialog is displayed', + ), + }; + return descriptions[eventName] || ''; +} /** * Detailed description for each hook event type (shown in detail view) */ -export const HOOK_DESCRIPTIONS: Record = { - [HookEventName.Stop]: '', - [HookEventName.PreToolUse]: - 'Input to command is JSON of tool call arguments.', - [HookEventName.PostToolUse]: - 'Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).', - [HookEventName.PostToolUseFailure]: - 'Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.', - [HookEventName.Notification]: - 'Input to command is JSON with notification message and type.', - [HookEventName.UserPromptSubmit]: - 'Input to command is JSON with original user prompt text.', - [HookEventName.SessionStart]: - 'Input to command is JSON with session start source.', - [HookEventName.SessionEnd]: - 'Input to command is JSON with session end reason.', - [HookEventName.SubagentStart]: - 'Input to command is JSON with agent_id and agent_type.', - [HookEventName.SubagentStop]: - 'Input to command is JSON with agent_id, agent_type, and agent_transcript_path.', - [HookEventName.PreCompact]: - 'Input to command is JSON with compaction details.', - [HookEventName.PermissionRequest]: - 'Input to command is JSON with tool_name, tool_input, and tool_use_id. Output JSON with hookSpecificOutput containing decision to allow or deny.', -}; +export function getHookDescription(eventName: string): string { + const descriptions: Record = { + [HookEventName.Stop]: '', + [HookEventName.PreToolUse]: t( + 'Input to command is JSON of tool call arguments.', + ), + [HookEventName.PostToolUse]: t( + 'Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).', + ), + [HookEventName.PostToolUseFailure]: t( + 'Input to command is JSON with tool_name, tool_input, tool_use_id, error, error_type, is_interrupt, and is_timeout.', + ), + [HookEventName.Notification]: t( + 'Input to command is JSON with notification message and type.', + ), + [HookEventName.UserPromptSubmit]: t( + 'Input to command is JSON with original user prompt text.', + ), + [HookEventName.SessionStart]: t( + 'Input to command is JSON with session start source.', + ), + [HookEventName.SessionEnd]: t( + 'Input to command is JSON with session end reason.', + ), + [HookEventName.SubagentStart]: t( + 'Input to command is JSON with agent_id and agent_type.', + ), + [HookEventName.SubagentStop]: t( + 'Input to command is JSON with agent_id, agent_type, and agent_transcript_path.', + ), + [HookEventName.PreCompact]: t( + 'Input to command is JSON with compaction details.', + ), + [HookEventName.PermissionRequest]: t( + 'Input to command is JSON with tool_name, tool_input, and tool_use_id. Output JSON with hookSpecificOutput containing decision to allow or deny.', + ), + }; + return descriptions[eventName] || ''; +} /** - * Source display mapping + * Source display mapping (translated) */ -export const SOURCE_DISPLAY_MAP: Record = { - [HooksConfigSource.Project]: 'Local Settings', - [HooksConfigSource.User]: 'User Settings', - [HooksConfigSource.System]: 'System Settings', - [HooksConfigSource.Extensions]: 'Extensions', -}; +export function getTranslatedSourceDisplayMap(): Record< + HooksConfigSource, + string +> { + return { + [HooksConfigSource.Project]: t('Local Settings'), + [HooksConfigSource.User]: t('User Settings'), + [HooksConfigSource.System]: t('System Settings'), + [HooksConfigSource.Extensions]: t('Extensions'), + }; +} /** * List of hook events to display in the UI @@ -171,9 +209,9 @@ export function createEmptyHookEventInfo( ): HookEventDisplayInfo { return { event: eventName, - shortDescription: HOOK_SHORT_DESCRIPTIONS[eventName] || '', - description: HOOK_DESCRIPTIONS[eventName] || '', - exitCodes: HOOK_EXIT_CODES[eventName] || [], + shortDescription: getHookShortDescription(eventName), + description: getHookDescription(eventName), + exitCodes: getHookExitCodes(eventName), configs: [], }; }