Skip to content

Commit 7dd9357

Browse files
committed
fix(i18n): add error messages for Claude Code process handling in multiple languages
1 parent c437053 commit 7dd9357

File tree

19 files changed

+133
-25
lines changed

19 files changed

+133
-25
lines changed

src/api/providers/claude-code.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ApiStreamUsageChunk, type ApiStream } from "../transform/stream"
1010
import { runClaudeCode } from "../../integrations/claude-code/run"
1111
import { ClaudeCodeMessage } from "../../integrations/claude-code/types"
1212
import { BaseProvider } from "./base-provider"
13+
import { t } from "../../i18n"
1314

1415
export class ClaudeCodeHandler extends BaseProvider implements ApiHandler {
1516
private options: ApiHandlerOptions
@@ -70,7 +71,8 @@ export class ClaudeCodeHandler extends BaseProvider implements ApiHandler {
7071

7172
if (exitCode !== null && exitCode !== 0) {
7273
throw new Error(
73-
`Claude Code process exited with code ${exitCode}.${errorOutput ? ` Error output: ${errorOutput.trim()}` : ""}`,
74+
t("common:errors.claudeCode.processExited", { exitCode }) +
75+
(errorOutput ? ` ${t("common:errors.claudeCode.errorOutput", { output: errorOutput.trim() })}` : ""),
7476
)
7577
}
7678

@@ -99,13 +101,11 @@ export class ClaudeCodeHandler extends BaseProvider implements ApiHandler {
99101

100102
if (message.stop_reason !== null && message.stop_reason !== "tool_use") {
101103
const errorMessage =
102-
message.content[0]?.text || `Claude Code stopped with reason: ${message.stop_reason}`
103-
104+
message.content[0]?.text ||
105+
t("common:errors.claudeCode.stoppedWithReason", { reason: message.stop_reason })
106+
104107
if (errorMessage.includes("Invalid model name")) {
105-
throw new Error(
106-
errorMessage +
107-
`\n\nAPI keys and subscription plans allow different models. Make sure the selected model is included in your plan.`,
108-
)
108+
throw new Error(errorMessage + `\n\n${t("common:errors.claudeCode.apiKeyModelPlanMismatch")}`)
109109
}
110110

111111
throw new Error(errorMessage)

src/i18n/locales/ca/common.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@
6666
"share_no_active_task": "No hi ha cap tasca activa per compartir",
6767
"share_auth_required": "Es requereix autenticació. Si us plau, inicia sessió per compartir tasques.",
6868
"share_not_enabled": "La compartició de tasques no està habilitada per a aquesta organització.",
69-
"share_task_not_found": "Tasca no trobada o accés denegat."
69+
"share_task_not_found": "Tasca no trobada o accés denegat.",
70+
"claudeCode": {
71+
"processExited": "El procés Claude Code ha sortit amb codi {{exitCode}}.",
72+
"errorOutput": "Sortida d'error: {{output}}",
73+
"stoppedWithReason": "Claude Code s'ha aturat per la raó: {{reason}}",
74+
"apiKeyModelPlanMismatch": "Les claus API i els plans de subscripció permeten models diferents. Assegura't que el model seleccionat estigui inclòs al teu pla."
75+
}
7076
},
7177
"warnings": {
7278
"no_terminal_content": "No s'ha seleccionat contingut de terminal",

src/i18n/locales/de/common.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
"share_no_active_task": "Keine aktive Aufgabe zum Teilen",
6363
"share_auth_required": "Authentifizierung erforderlich. Bitte melde dich an, um Aufgaben zu teilen.",
6464
"share_not_enabled": "Aufgabenfreigabe ist für diese Organisation nicht aktiviert.",
65-
"share_task_not_found": "Aufgabe nicht gefunden oder Zugriff verweigert."
65+
"share_task_not_found": "Aufgabe nicht gefunden oder Zugriff verweigert.",
66+
"claudeCode": {
67+
"processExited": "Claude Code Prozess wurde mit Code {{exitCode}} beendet.",
68+
"errorOutput": "Fehlerausgabe: {{output}}",
69+
"stoppedWithReason": "Claude Code wurde mit Grund gestoppt: {{reason}}",
70+
"apiKeyModelPlanMismatch": "API-Schlüssel und Abonnement-Pläne erlauben verschiedene Modelle. Stelle sicher, dass das ausgewählte Modell in deinem Plan enthalten ist."
71+
}
6672
},
6773
"warnings": {
6874
"no_terminal_content": "Kein Terminal-Inhalt ausgewählt",

src/i18n/locales/en/common.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
"share_no_active_task": "No active task to share",
6363
"share_auth_required": "Authentication required. Please sign in to share tasks.",
6464
"share_not_enabled": "Task sharing is not enabled for this organization.",
65-
"share_task_not_found": "Task not found or access denied."
65+
"share_task_not_found": "Task not found or access denied.",
66+
"claudeCode": {
67+
"processExited": "Claude Code process exited with code {{exitCode}}.",
68+
"errorOutput": "Error output: {{output}}",
69+
"stoppedWithReason": "Claude Code stopped with reason: {{reason}}",
70+
"apiKeyModelPlanMismatch": "API keys and subscription plans allow different models. Make sure the selected model is included in your plan."
71+
}
6672
},
6773
"warnings": {
6874
"no_terminal_content": "No terminal content selected",

src/i18n/locales/es/common.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
"share_no_active_task": "No hay tarea activa para compartir",
6363
"share_auth_required": "Se requiere autenticación. Por favor, inicia sesión para compartir tareas.",
6464
"share_not_enabled": "La compartición de tareas no está habilitada para esta organización.",
65-
"share_task_not_found": "Tarea no encontrada o acceso denegado."
65+
"share_task_not_found": "Tarea no encontrada o acceso denegado.",
66+
"claudeCode": {
67+
"processExited": "El proceso de Claude Code terminó con código {{exitCode}}.",
68+
"errorOutput": "Salida de error: {{output}}",
69+
"stoppedWithReason": "Claude Code se detuvo por la razón: {{reason}}",
70+
"apiKeyModelPlanMismatch": "Las claves API y los planes de suscripción permiten diferentes modelos. Asegúrate de que el modelo seleccionado esté incluido en tu plan."
71+
}
6672
},
6773
"warnings": {
6874
"no_terminal_content": "No hay contenido de terminal seleccionado",

src/i18n/locales/fr/common.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
"share_no_active_task": "Aucune tâche active à partager",
6363
"share_auth_required": "Authentification requise. Veuillez vous connecter pour partager des tâches.",
6464
"share_not_enabled": "Le partage de tâches n'est pas activé pour cette organisation.",
65-
"share_task_not_found": "Tâche non trouvée ou accès refusé."
65+
"share_task_not_found": "Tâche non trouvée ou accès refusé.",
66+
"claudeCode": {
67+
"processExited": "Le processus Claude Code s'est terminé avec le code {{exitCode}}.",
68+
"errorOutput": "Sortie d'erreur : {{output}}",
69+
"stoppedWithReason": "Claude Code s'est arrêté pour la raison : {{reason}}",
70+
"apiKeyModelPlanMismatch": "Les clés API et les plans d'abonnement permettent différents modèles. Assurez-vous que le modèle sélectionné est inclus dans votre plan."
71+
}
6672
},
6773
"warnings": {
6874
"no_terminal_content": "Aucun contenu de terminal sélectionné",

src/i18n/locales/hi/common.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
"share_no_active_task": "साझा करने के लिए कोई सक्रिय कार्य नहीं",
6363
"share_auth_required": "प्रमाणीकरण आवश्यक है। कार्य साझा करने के लिए कृपया साइन इन करें।",
6464
"share_not_enabled": "इस संगठन के लिए कार्य साझाकरण सक्षम नहीं है।",
65-
"share_task_not_found": "कार्य नहीं मिला या पहुंच अस्वीकृत।"
65+
"share_task_not_found": "कार्य नहीं मिला या पहुंच अस्वीकृत।",
66+
"claudeCode": {
67+
"processExited": "Claude Code प्रक्रिया कोड {{exitCode}} के साथ समाप्त हुई।",
68+
"errorOutput": "त्रुटि आउटपुट: {{output}}",
69+
"stoppedWithReason": "Claude Code इस कारण से रुका: {{reason}}",
70+
"apiKeyModelPlanMismatch": "API कुंजी और सब्सक्रिप्शन प्लान अलग-अलग मॉडल की अनुमति देते हैं। सुनिश्चित करें कि चयनित मॉडल आपकी योजना में शामिल है।"
71+
}
6672
},
6773
"warnings": {
6874
"no_terminal_content": "कोई टर्मिनल सामग्री चयनित नहीं",

src/i18n/locales/id/common.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
"share_no_active_task": "Tidak ada tugas aktif untuk dibagikan",
6363
"share_auth_required": "Autentikasi diperlukan. Silakan masuk untuk berbagi tugas.",
6464
"share_not_enabled": "Berbagi tugas tidak diaktifkan untuk organisasi ini.",
65-
"share_task_not_found": "Tugas tidak ditemukan atau akses ditolak."
65+
"share_task_not_found": "Tugas tidak ditemukan atau akses ditolak.",
66+
"claudeCode": {
67+
"processExited": "Proses Claude Code keluar dengan kode {{exitCode}}.",
68+
"errorOutput": "Output error: {{output}}",
69+
"stoppedWithReason": "Claude Code berhenti karena alasan: {{reason}}",
70+
"apiKeyModelPlanMismatch": "Kunci API dan paket berlangganan memungkinkan model yang berbeda. Pastikan model yang dipilih termasuk dalam paket Anda."
71+
}
6672
},
6773
"warnings": {
6874
"no_terminal_content": "Tidak ada konten terminal yang dipilih",

src/i18n/locales/it/common.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
"share_no_active_task": "Nessuna attività attiva da condividere",
6363
"share_auth_required": "Autenticazione richiesta. Accedi per condividere le attività.",
6464
"share_not_enabled": "La condivisione delle attività non è abilitata per questa organizzazione.",
65-
"share_task_not_found": "Attività non trovata o accesso negato."
65+
"share_task_not_found": "Attività non trovata o accesso negato.",
66+
"claudeCode": {
67+
"processExited": "Il processo Claude Code è terminato con codice {{exitCode}}.",
68+
"errorOutput": "Output di errore: {{output}}",
69+
"stoppedWithReason": "Claude Code si è fermato per il motivo: {{reason}}",
70+
"apiKeyModelPlanMismatch": "Le chiavi API e i piani di abbonamento consentono modelli diversi. Assicurati che il modello selezionato sia incluso nel tuo piano."
71+
}
6672
},
6773
"warnings": {
6874
"no_terminal_content": "Nessun contenuto del terminale selezionato",

src/i18n/locales/ja/common.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@
6262
"share_no_active_task": "共有するアクティブなタスクがありません",
6363
"share_auth_required": "認証が必要です。タスクを共有するにはサインインしてください。",
6464
"share_not_enabled": "この組織ではタスク共有が有効になっていません。",
65-
"share_task_not_found": "タスクが見つからないか、アクセスが拒否されました。"
65+
"share_task_not_found": "タスクが見つからないか、アクセスが拒否されました。",
66+
"claudeCode": {
67+
"processExited": "Claude Code プロセスがコード {{exitCode}} で終了しました。",
68+
"errorOutput": "エラー出力:{{output}}",
69+
"stoppedWithReason": "Claude Code が理由により停止しました:{{reason}}",
70+
"apiKeyModelPlanMismatch": "API キーとサブスクリプションプランでは異なるモデルが利用可能です。選択したモデルがプランに含まれていることを確認してください。"
71+
}
6672
},
6773
"warnings": {
6874
"no_terminal_content": "選択されたターミナルコンテンツがありません",

0 commit comments

Comments
 (0)