Skip to content

Commit 8b50b3a

Browse files
committed
feat: add translations for processExitedWithError key
- Added processExitedWithError translation key to all supported languages - This replaces concatenated translation calls with a single unified key - Allows for more natural word order in non-English languages - Addresses review feedback from PR #4864
1 parent 7dd9357 commit 8b50b3a

File tree

19 files changed

+28
-5
lines changed

19 files changed

+28
-5
lines changed

src/api/providers/claude-code.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,15 @@ export class ClaudeCodeHandler extends BaseProvider implements ApiHandler {
7070
}
7171

7272
if (exitCode !== null && exitCode !== 0) {
73-
throw new Error(
74-
t("common:errors.claudeCode.processExited", { exitCode }) +
75-
(errorOutput ? ` ${t("common:errors.claudeCode.errorOutput", { output: errorOutput.trim() })}` : ""),
76-
)
73+
if (errorOutput) {
74+
throw new Error(
75+
t("common:errors.claudeCode.processExitedWithError", {
76+
exitCode,
77+
output: errorOutput.trim(),
78+
}),
79+
)
80+
}
81+
throw new Error(t("common:errors.claudeCode.processExited", { exitCode }))
7782
}
7883

7984
const data = dataQueue.shift()
@@ -103,7 +108,7 @@ export class ClaudeCodeHandler extends BaseProvider implements ApiHandler {
103108
const errorMessage =
104109
message.content[0]?.text ||
105110
t("common:errors.claudeCode.stoppedWithReason", { reason: message.stop_reason })
106-
111+
107112
if (errorMessage.includes("Invalid model name")) {
108113
throw new Error(errorMessage + `\n\n${t("common:errors.claudeCode.apiKeyModelPlanMismatch")}`)
109114
}

src/i18n/locales/ca/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"claudeCode": {
7171
"processExited": "El procés Claude Code ha sortit amb codi {{exitCode}}.",
7272
"errorOutput": "Sortida d'error: {{output}}",
73+
"processExitedWithError": "El procés Claude Code ha sortit amb codi {{exitCode}}. Sortida d'error: {{output}}",
7374
"stoppedWithReason": "Claude Code s'ha aturat per la raó: {{reason}}",
7475
"apiKeyModelPlanMismatch": "Les claus API i els plans de subscripció permeten models diferents. Assegura't que el model seleccionat estigui inclòs al teu pla."
7576
}

src/i18n/locales/de/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"claudeCode": {
6767
"processExited": "Claude Code Prozess wurde mit Code {{exitCode}} beendet.",
6868
"errorOutput": "Fehlerausgabe: {{output}}",
69+
"processExitedWithError": "Claude Code Prozess wurde mit Code {{exitCode}} beendet. Fehlerausgabe: {{output}}",
6970
"stoppedWithReason": "Claude Code wurde mit Grund gestoppt: {{reason}}",
7071
"apiKeyModelPlanMismatch": "API-Schlüssel und Abonnement-Pläne erlauben verschiedene Modelle. Stelle sicher, dass das ausgewählte Modell in deinem Plan enthalten ist."
7172
}

src/i18n/locales/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"claudeCode": {
6767
"processExited": "Claude Code process exited with code {{exitCode}}.",
6868
"errorOutput": "Error output: {{output}}",
69+
"processExitedWithError": "Claude Code process exited with code {{exitCode}}. Error output: {{output}}",
6970
"stoppedWithReason": "Claude Code stopped with reason: {{reason}}",
7071
"apiKeyModelPlanMismatch": "API keys and subscription plans allow different models. Make sure the selected model is included in your plan."
7172
}

src/i18n/locales/es/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"claudeCode": {
6767
"processExited": "El proceso de Claude Code terminó con código {{exitCode}}.",
6868
"errorOutput": "Salida de error: {{output}}",
69+
"processExitedWithError": "El proceso de Claude Code terminó con código {{exitCode}}. Salida de error: {{output}}",
6970
"stoppedWithReason": "Claude Code se detuvo por la razón: {{reason}}",
7071
"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."
7172
}

src/i18n/locales/fr/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"claudeCode": {
6767
"processExited": "Le processus Claude Code s'est terminé avec le code {{exitCode}}.",
6868
"errorOutput": "Sortie d'erreur : {{output}}",
69+
"processExitedWithError": "Le processus Claude Code s'est terminé avec le code {{exitCode}}. Sortie d'erreur : {{output}}",
6970
"stoppedWithReason": "Claude Code s'est arrêté pour la raison : {{reason}}",
7071
"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."
7172
}

src/i18n/locales/hi/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"claudeCode": {
6767
"processExited": "Claude Code प्रक्रिया कोड {{exitCode}} के साथ समाप्त हुई।",
6868
"errorOutput": "त्रुटि आउटपुट: {{output}}",
69+
"processExitedWithError": "Claude Code प्रक्रिया कोड {{exitCode}} के साथ समाप्त हुई। त्रुटि आउटपुट: {{output}}",
6970
"stoppedWithReason": "Claude Code इस कारण से रुका: {{reason}}",
7071
"apiKeyModelPlanMismatch": "API कुंजी और सब्सक्रिप्शन प्लान अलग-अलग मॉडल की अनुमति देते हैं। सुनिश्चित करें कि चयनित मॉडल आपकी योजना में शामिल है।"
7172
}

src/i18n/locales/id/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"claudeCode": {
6767
"processExited": "Proses Claude Code keluar dengan kode {{exitCode}}.",
6868
"errorOutput": "Output error: {{output}}",
69+
"processExitedWithError": "Proses Claude Code keluar dengan kode {{exitCode}}. Output error: {{output}}",
6970
"stoppedWithReason": "Claude Code berhenti karena alasan: {{reason}}",
7071
"apiKeyModelPlanMismatch": "Kunci API dan paket berlangganan memungkinkan model yang berbeda. Pastikan model yang dipilih termasuk dalam paket Anda."
7172
}

src/i18n/locales/it/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"claudeCode": {
6767
"processExited": "Il processo Claude Code è terminato con codice {{exitCode}}.",
6868
"errorOutput": "Output di errore: {{output}}",
69+
"processExitedWithError": "Il processo Claude Code è terminato con codice {{exitCode}}. Output di errore: {{output}}",
6970
"stoppedWithReason": "Claude Code si è fermato per il motivo: {{reason}}",
7071
"apiKeyModelPlanMismatch": "Le chiavi API e i piani di abbonamento consentono modelli diversi. Assicurati che il modello selezionato sia incluso nel tuo piano."
7172
}

src/i18n/locales/ja/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"claudeCode": {
6767
"processExited": "Claude Code プロセスがコード {{exitCode}} で終了しました。",
6868
"errorOutput": "エラー出力:{{output}}",
69+
"processExitedWithError": "Claude Code プロセスがコード {{exitCode}} で終了しました。エラー出力:{{output}}",
6970
"stoppedWithReason": "Claude Code が理由により停止しました:{{reason}}",
7071
"apiKeyModelPlanMismatch": "API キーとサブスクリプションプランでは異なるモデルが利用可能です。選択したモデルがプランに含まれていることを確認してください。"
7172
}

0 commit comments

Comments
 (0)