From 39ed66c97f7600244bc6093e89822e93ea012ff4 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 16 Apr 2026 16:51:03 +0200 Subject: [PATCH] feat(#221): add i18n keys and error codes for tag hierarchy errors Adds INVALID_TAG_COLOR and TAG_CYCLE_DETECTED to the frontend ErrorCode type and getErrorMessage() switch. German, English, and Spanish translations added for both codes. Co-Authored-By: Claude Sonnet 4.6 --- frontend/messages/de.json | 2 ++ frontend/messages/en.json | 2 ++ frontend/messages/es.json | 2 ++ frontend/src/lib/errors.ts | 6 ++++++ 4 files changed, 12 insertions(+) diff --git a/frontend/messages/de.json b/frontend/messages/de.json index da516d83..ea68718a 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -501,6 +501,8 @@ "error_ocr_document_not_uploaded": "Das Dokument hat keine Datei — OCR ist nicht möglich.", "error_ocr_processing_failed": "Die OCR-Verarbeitung ist fehlgeschlagen.", "error_training_already_running": "Es läuft bereits ein Trainings-Vorgang.", + "error_invalid_tag_color": "Die gewählte Farbe ist ungültig.", + "error_tag_cycle_detected": "Dieses übergeordnete Schlagwort würde einen Kreis erzeugen.", "ocr_script_type_typewriter": "Schreibmaschine", "ocr_script_type_handwriting_latin": "Handschrift (lateinisch)", "ocr_script_type_handwriting_kurrent": "Handschrift (Kurrent/Sütterlin)", diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 86c3dd90..5a91459d 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -501,6 +501,8 @@ "error_ocr_document_not_uploaded": "The document has no file — OCR is not possible.", "error_ocr_processing_failed": "OCR processing failed.", "error_training_already_running": "A training run is already in progress.", + "error_invalid_tag_color": "The chosen color is not valid.", + "error_tag_cycle_detected": "This parent tag would create a cycle.", "ocr_script_type_typewriter": "Typewriter", "ocr_script_type_handwriting_latin": "Handwriting (Latin)", "ocr_script_type_handwriting_kurrent": "Handwriting (Kurrent/Sütterlin)", diff --git a/frontend/messages/es.json b/frontend/messages/es.json index 07924e14..d2d09489 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -501,6 +501,8 @@ "error_ocr_document_not_uploaded": "El documento no tiene archivo — OCR no es posible.", "error_ocr_processing_failed": "El procesamiento OCR ha fallado.", "error_training_already_running": "Ya hay un proceso de entrenamiento en curso.", + "error_invalid_tag_color": "El color elegido no es válido.", + "error_tag_cycle_detected": "Esta etiqueta padre crearía un ciclo.", "ocr_script_type_typewriter": "Máquina de escribir", "ocr_script_type_handwriting_latin": "Escritura manuscrita (latina)", "ocr_script_type_handwriting_kurrent": "Escritura manuscrita (Kurrent/Sütterlin)", diff --git a/frontend/src/lib/errors.ts b/frontend/src/lib/errors.ts index 23a76344..f712319c 100644 --- a/frontend/src/lib/errors.ts +++ b/frontend/src/lib/errors.ts @@ -27,6 +27,8 @@ export type ErrorCode = | 'OCR_DOCUMENT_NOT_UPLOADED' | 'OCR_PROCESSING_FAILED' | 'TRAINING_ALREADY_RUNNING' + | 'INVALID_TAG_COLOR' + | 'TAG_CYCLE_DETECTED' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'VALIDATION_ERROR' @@ -100,6 +102,10 @@ export function getErrorMessage(code: ErrorCode | string | undefined): string { return m.error_ocr_processing_failed(); case 'TRAINING_ALREADY_RUNNING': return m.error_training_already_running(); + case 'INVALID_TAG_COLOR': + return m.error_invalid_tag_color(); + case 'TAG_CYCLE_DETECTED': + return m.error_tag_cycle_detected(); case 'UNAUTHORIZED': return m.error_unauthorized(); case 'FORBIDDEN':