From 82c840116756132d297fd84f0769ad74117377c9 Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 20 Mar 2026 23:03:19 +0100 Subject: [PATCH] feat(frontend): add i18n messages and error codes for profile feature Add profile_* message keys for the profile page forms in de/en/es. Add EMAIL_ALREADY_IN_USE and WRONG_CURRENT_PASSWORD to ErrorCode type and getErrorMessage switch. Co-Authored-By: Claude Sonnet 4.6 --- frontend/messages/de.json | 37 ++++++++++++++++++++----------------- frontend/messages/en.json | 37 ++++++++++++++++++++----------------- frontend/messages/es.json | 37 ++++++++++++++++++++----------------- frontend/src/lib/errors.ts | 6 ++++++ 4 files changed, 66 insertions(+), 51 deletions(-) diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 52a3f977..b26158df 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -1,6 +1,5 @@ { "$schema": "https://inlang.com/schema/inlang-message-format", - "error_document_not_found": "Das Dokument wurde nicht gefunden.", "error_document_no_file": "Diesem Dokument ist noch keine Datei zugeordnet.", "error_file_not_found": "Die Datei konnte im Speicher nicht gefunden werden.", @@ -11,13 +10,11 @@ "error_forbidden": "Sie haben keine Berechtigung für diese Aktion.", "error_validation_error": "Die Eingabe ist ungültig.", "error_internal_error": "Ein unerwarteter Fehler ist aufgetreten.", - "nav_documents": "Dokumente", "nav_persons": "Personen", "nav_conversations": "Konversationen", "nav_admin": "Admin", "nav_logout": "Abmelden", - "btn_save": "Speichern", "btn_cancel": "Abbrechen", "btn_edit": "Bearbeiten", @@ -26,7 +23,6 @@ "btn_back_to_overview": "Zurück zur Übersicht", "btn_back": "Zurück", "btn_back_to_document": "Zurück zum Dokument", - "form_label_first_name": "Vorname", "form_label_last_name": "Nachname", "form_label_alias": "Rufname / Alias", @@ -47,12 +43,10 @@ "form_label_archive_location": "Aufbewahrungsort", "form_placeholder_archive_location": "z.B. Schrank 3, Mappe B", "form_helper_archive_location": "Wo befindet sich das Originaldokument?", - "login_heading": "Anmelden", "login_label_username": "Benutzername", "login_label_password": "Passwort", "login_btn_submit": "Anmelden", - "docs_search_placeholder": "Suche in Titel, Inhalt, Ort...", "docs_btn_filter": "Filter", "docs_btn_reset_title": "Filter zurücksetzen", @@ -68,7 +62,6 @@ "docs_list_from": "Von", "docs_list_to": "An", "docs_list_unknown": "Unbekannt", - "doc_section_who_when": "Wer & Wann", "doc_section_description": "Beschreibung", "doc_section_file": "Datei", @@ -79,7 +72,6 @@ "doc_current_file_label": "Aktuelle Datei:", "doc_new_heading": "Neues Dokument", "doc_edit_heading": "Bearbeiten", - "doc_section_details": "Details", "doc_label_document_date": "Dokumentendatum", "doc_label_creation_location": "Erstellungsort", @@ -92,17 +84,14 @@ "doc_loading": "Lade Dokument...", "doc_download_link": "Direkter Download versuchen", "doc_no_scan": "Kein Scan vorhanden", - "persons_heading": "Personenverzeichnis", "persons_subtitle": "Durchsuchen Sie den Index aller erfassten Personen im Familienarchiv.", "persons_btn_new": "Neue Person", "persons_search_placeholder": "Namen suchen...", "persons_empty_heading": "Keine Personen gefunden.", "persons_empty_text": "Versuchen Sie einen anderen Suchbegriff.", - "persons_new_heading": "Neue Person", "persons_section_details": "Angaben zur Person", - "person_edit_heading": "Person bearbeiten", "person_label_full_name": "Voller Name", "person_merge_heading": "Person zusammenführen", @@ -126,7 +115,6 @@ "person_role_receiver": "Empfangen", "person_co_correspondents_heading": "Häufige Korrespondenten", "person_show_more": "+ {count} weitere anzeigen", - "conv_heading": "Konversationen", "conv_subtitle": "Verfolgen Sie den Schriftverkehr zwischen zwei Personen chronologisch.", "conv_label_person_a": "Person A (Absender)", @@ -143,7 +131,6 @@ "conv_swap_btn": "Personen tauschen", "conv_summary": "{count} Dokumente · {yearFrom}–{yearTo}", "conv_new_doc_link": "Neues Dokument in dieser Korrespondenz", - "admin_heading": "Admin Dashboard", "admin_tab_users": "Benutzer", "admin_tab_groups": "Gruppen", @@ -172,7 +159,6 @@ "admin_section_new_group": "Neue Gruppe anlegen", "admin_group_name_placeholder": "Gruppenname (z.B. Editoren)", "admin_user_delete_confirm": "Benutzer {username} wirklich löschen?", - "doc_file_error_preview": "Vorschau konnte nicht geladen werden.", "doc_download_title": "Herunterladen", "doc_tag_filter_title": "Nach {name} filtern", @@ -180,9 +166,7 @@ "doc_preview_iframe_title": "Dokumentvorschau", "doc_image_alt": "Original-Scan", "doc_no_date": "Kein Datum", - "person_merge_will_be_deleted": "wird gelöscht.", - "comp_typeahead_placeholder": "Namen tippen...", "comp_typeahead_loading": "Suche...", "comp_multiselect_placeholder": "Namen tippen...", @@ -191,5 +175,24 @@ "comp_taginput_placeholder_create": "Schlagworte hinzufügen...", "comp_taginput_placeholder_filter": "Nach Schlagworten filtern...", "comp_taginput_remove": "Schlagwort entfernen", - "comp_taginput_create_hint": "Enter drücken um Schlagwort zu erstellen." + "comp_taginput_create_hint": "Enter drücken um Schlagwort zu erstellen.", + "error_email_already_in_use": "Diese E-Mail-Adresse wird bereits von einem anderen Konto verwendet.", + "error_wrong_current_password": "Das aktuelle Passwort ist falsch.", + "nav_profile": "Profil", + "profile_heading": "Mein Profil", + "profile_section_personal": "Persönliche Daten", + "profile_label_first_name": "Vorname", + "profile_label_last_name": "Nachname", + "profile_label_birth_date": "Geburtsdatum", + "profile_label_email": "E-Mail-Adresse", + "profile_label_contact": "Kontaktdaten", + "profile_contact_placeholder": "Telefon, Adresse oder sonstige Hinweise...", + "profile_section_password": "Passwort ändern", + "profile_label_current_password": "Aktuelles Passwort", + "profile_label_new_password": "Neues Passwort", + "profile_label_new_password_confirm": "Neues Passwort (Wiederholung)", + "profile_password_mismatch": "Die neuen Passwörter stimmen nicht überein.", + "profile_saved": "Gespeichert.", + "profile_password_changed": "Passwort erfolgreich geändert.", + "user_profile_heading": "Profil von" } diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 75fa54f9..86f97be0 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -1,6 +1,5 @@ { "$schema": "https://inlang.com/schema/inlang-message-format", - "error_document_not_found": "Document not found.", "error_document_no_file": "No file is associated with this document.", "error_file_not_found": "The file could not be found in storage.", @@ -11,13 +10,11 @@ "error_forbidden": "You do not have permission for this action.", "error_validation_error": "The input is invalid.", "error_internal_error": "An unexpected error occurred.", - "nav_documents": "Documents", "nav_persons": "Persons", "nav_conversations": "Conversations", "nav_admin": "Admin", "nav_logout": "Sign out", - "btn_save": "Save", "btn_cancel": "Cancel", "btn_edit": "Edit", @@ -26,7 +23,6 @@ "btn_back_to_overview": "Back to overview", "btn_back": "Back", "btn_back_to_document": "Back to document", - "form_label_first_name": "First name", "form_label_last_name": "Last name", "form_label_alias": "Nickname / Alias", @@ -47,12 +43,10 @@ "form_label_archive_location": "Storage location", "form_placeholder_archive_location": "e.g. Cabinet 3, Folder B", "form_helper_archive_location": "Where is the original document stored?", - "login_heading": "Sign in", "login_label_username": "Username", "login_label_password": "Password", "login_btn_submit": "Sign in", - "docs_search_placeholder": "Search in title, content, location...", "docs_btn_filter": "Filter", "docs_btn_reset_title": "Reset filter", @@ -68,7 +62,6 @@ "docs_list_from": "From", "docs_list_to": "To", "docs_list_unknown": "Unknown", - "doc_section_who_when": "Who & When", "doc_section_description": "Description", "doc_section_file": "File", @@ -79,7 +72,6 @@ "doc_current_file_label": "Current file:", "doc_new_heading": "New document", "doc_edit_heading": "Edit", - "doc_section_details": "Details", "doc_label_document_date": "Document date", "doc_label_creation_location": "Place of creation", @@ -92,17 +84,14 @@ "doc_loading": "Loading document...", "doc_download_link": "Try direct download", "doc_no_scan": "No scan available", - "persons_heading": "Person directory", "persons_subtitle": "Browse the index of all recorded persons in the family archive.", "persons_btn_new": "New person", "persons_search_placeholder": "Search names...", "persons_empty_heading": "No persons found.", "persons_empty_text": "Try a different search term.", - "persons_new_heading": "New person", "persons_section_details": "Person details", - "person_edit_heading": "Edit person", "person_label_full_name": "Full name", "person_merge_heading": "Merge person", @@ -126,7 +115,6 @@ "person_role_receiver": "Received", "person_co_correspondents_heading": "Frequent correspondents", "person_show_more": "+ {count} more", - "conv_heading": "Conversations", "conv_subtitle": "Follow the correspondence between two persons chronologically.", "conv_label_person_a": "Person A (Sender)", @@ -143,7 +131,6 @@ "conv_swap_btn": "Swap persons", "conv_summary": "{count} documents · {yearFrom}–{yearTo}", "conv_new_doc_link": "New document in this correspondence", - "admin_heading": "Admin Dashboard", "admin_tab_users": "Users", "admin_tab_groups": "Groups", @@ -172,7 +159,6 @@ "admin_section_new_group": "Create new group", "admin_group_name_placeholder": "Group name (e.g. Editors)", "admin_user_delete_confirm": "Really delete user {username}?", - "doc_file_error_preview": "Could not load preview.", "doc_download_title": "Download", "doc_tag_filter_title": "Filter by {name}", @@ -180,9 +166,7 @@ "doc_preview_iframe_title": "Document Preview", "doc_image_alt": "Original scan", "doc_no_date": "No date", - "person_merge_will_be_deleted": "will be deleted.", - "comp_typeahead_placeholder": "Type a name...", "comp_typeahead_loading": "Searching...", "comp_multiselect_placeholder": "Type a name...", @@ -191,5 +175,24 @@ "comp_taginput_placeholder_create": "Add tags...", "comp_taginput_placeholder_filter": "Filter by tags...", "comp_taginput_remove": "Remove tag", - "comp_taginput_create_hint": "Press Enter to create tag." + "comp_taginput_create_hint": "Press Enter to create tag.", + "error_email_already_in_use": "This email address is already used by another account.", + "error_wrong_current_password": "The current password is incorrect.", + "nav_profile": "Profile", + "profile_heading": "My Profile", + "profile_section_personal": "Personal Information", + "profile_label_first_name": "First name", + "profile_label_last_name": "Last name", + "profile_label_birth_date": "Date of birth", + "profile_label_email": "Email address", + "profile_label_contact": "Contact details", + "profile_contact_placeholder": "Phone, address or other notes...", + "profile_section_password": "Change password", + "profile_label_current_password": "Current password", + "profile_label_new_password": "New password", + "profile_label_new_password_confirm": "New password (repeat)", + "profile_password_mismatch": "The new passwords do not match.", + "profile_saved": "Saved.", + "profile_password_changed": "Password changed successfully.", + "user_profile_heading": "Profile of" } diff --git a/frontend/messages/es.json b/frontend/messages/es.json index 58be11ed..1e6ba43f 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -1,6 +1,5 @@ { "$schema": "https://inlang.com/schema/inlang-message-format", - "error_document_not_found": "Documento no encontrado.", "error_document_no_file": "No hay ningún archivo asociado a este documento.", "error_file_not_found": "El archivo no pudo encontrarse en el almacenamiento.", @@ -11,13 +10,11 @@ "error_forbidden": "No tiene permiso para realizar esta acción.", "error_validation_error": "La entrada no es válida.", "error_internal_error": "Se ha producido un error inesperado.", - "nav_documents": "Documentos", "nav_persons": "Personas", "nav_conversations": "Conversaciones", "nav_admin": "Admin", "nav_logout": "Cerrar sesión", - "btn_save": "Guardar", "btn_cancel": "Cancelar", "btn_edit": "Editar", @@ -26,7 +23,6 @@ "btn_back_to_overview": "Volver al resumen", "btn_back": "Volver", "btn_back_to_document": "Volver al documento", - "form_label_first_name": "Nombre", "form_label_last_name": "Apellido", "form_label_alias": "Apodo / Alias", @@ -47,12 +43,10 @@ "form_label_archive_location": "Ubicación de almacenamiento", "form_placeholder_archive_location": "p.ej. Armario 3, Carpeta B", "form_helper_archive_location": "¿Dónde se encuentra el documento original?", - "login_heading": "Iniciar sesión", "login_label_username": "Usuario", "login_label_password": "Contraseña", "login_btn_submit": "Iniciar sesión", - "docs_search_placeholder": "Buscar en título, contenido, lugar...", "docs_btn_filter": "Filtrar", "docs_btn_reset_title": "Restablecer filtro", @@ -68,7 +62,6 @@ "docs_list_from": "De", "docs_list_to": "Para", "docs_list_unknown": "Desconocido", - "doc_section_who_when": "Quién & Cuándo", "doc_section_description": "Descripción", "doc_section_file": "Archivo", @@ -79,7 +72,6 @@ "doc_current_file_label": "Archivo actual:", "doc_new_heading": "Nuevo documento", "doc_edit_heading": "Editar", - "doc_section_details": "Detalles", "doc_label_document_date": "Fecha del documento", "doc_label_creation_location": "Lugar de creación", @@ -92,17 +84,14 @@ "doc_loading": "Cargando documento...", "doc_download_link": "Intentar descarga directa", "doc_no_scan": "No hay escaneo disponible", - "persons_heading": "Directorio de personas", "persons_subtitle": "Explore el índice de todas las personas registradas en el archivo familiar.", "persons_btn_new": "Nueva persona", "persons_search_placeholder": "Buscar nombres...", "persons_empty_heading": "No se encontraron personas.", "persons_empty_text": "Pruebe con otro término de búsqueda.", - "persons_new_heading": "Nueva persona", "persons_section_details": "Datos de la persona", - "person_edit_heading": "Editar persona", "person_label_full_name": "Nombre completo", "person_merge_heading": "Fusionar persona", @@ -126,7 +115,6 @@ "person_role_receiver": "Recibido", "person_co_correspondents_heading": "Corresponsales frecuentes", "person_show_more": "+ {count} más", - "conv_heading": "Conversaciones", "conv_subtitle": "Siga la correspondencia entre dos personas cronológicamente.", "conv_label_person_a": "Persona A (Remitente)", @@ -143,7 +131,6 @@ "conv_swap_btn": "Intercambiar personas", "conv_summary": "{count} documentos · {yearFrom}–{yearTo}", "conv_new_doc_link": "Nuevo documento en esta correspondencia", - "admin_heading": "Panel de administración", "admin_tab_users": "Usuarios", "admin_tab_groups": "Grupos", @@ -172,7 +159,6 @@ "admin_section_new_group": "Crear nuevo grupo", "admin_group_name_placeholder": "Nombre del grupo (p.ej. Editores)", "admin_user_delete_confirm": "¿Realmente eliminar al usuario {username}?", - "doc_file_error_preview": "No se pudo cargar la vista previa.", "doc_download_title": "Descargar", "doc_tag_filter_title": "Filtrar por {name}", @@ -180,9 +166,7 @@ "doc_preview_iframe_title": "Vista previa del documento", "doc_image_alt": "Escaneado original", "doc_no_date": "Sin fecha", - "person_merge_will_be_deleted": "será eliminado.", - "comp_typeahead_placeholder": "Escriba un nombre...", "comp_typeahead_loading": "Buscando...", "comp_multiselect_placeholder": "Escriba un nombre...", @@ -191,5 +175,24 @@ "comp_taginput_placeholder_create": "Añadir etiquetas...", "comp_taginput_placeholder_filter": "Filtrar por etiquetas...", "comp_taginput_remove": "Eliminar etiqueta", - "comp_taginput_create_hint": "Pulse Enter para crear etiqueta." + "comp_taginput_create_hint": "Pulse Enter para crear etiqueta.", + "error_email_already_in_use": "Esta dirección de correo ya está en uso por otra cuenta.", + "error_wrong_current_password": "La contraseña actual es incorrecta.", + "nav_profile": "Perfil", + "profile_heading": "Mi perfil", + "profile_section_personal": "Información personal", + "profile_label_first_name": "Nombre", + "profile_label_last_name": "Apellido", + "profile_label_birth_date": "Fecha de nacimiento", + "profile_label_email": "Correo electrónico", + "profile_label_contact": "Datos de contacto", + "profile_contact_placeholder": "Teléfono, dirección u otras notas...", + "profile_section_password": "Cambiar contraseña", + "profile_label_current_password": "Contraseña actual", + "profile_label_new_password": "Nueva contraseña", + "profile_label_new_password_confirm": "Nueva contraseña (repetir)", + "profile_password_mismatch": "Las nuevas contraseñas no coinciden.", + "profile_saved": "Guardado.", + "profile_password_changed": "Contraseña cambiada con éxito.", + "user_profile_heading": "Perfil de" } diff --git a/frontend/src/lib/errors.ts b/frontend/src/lib/errors.ts index e3a16bc5..beb18d90 100644 --- a/frontend/src/lib/errors.ts +++ b/frontend/src/lib/errors.ts @@ -10,6 +10,8 @@ export type ErrorCode = | 'FILE_NOT_FOUND' | 'FILE_UPLOAD_FAILED' | 'USER_NOT_FOUND' + | 'EMAIL_ALREADY_IN_USE' + | 'WRONG_CURRENT_PASSWORD' | 'IMPORT_ALREADY_RUNNING' | 'UNAUTHORIZED' | 'FORBIDDEN' @@ -50,6 +52,10 @@ export function getErrorMessage(code: ErrorCode | string | undefined): string { return m.error_file_upload_failed(); case 'USER_NOT_FOUND': return m.error_user_not_found(); + case 'EMAIL_ALREADY_IN_USE': + return m.error_email_already_in_use(); + case 'WRONG_CURRENT_PASSWORD': + return m.error_wrong_current_password(); case 'IMPORT_ALREADY_RUNNING': return m.error_import_already_running(); case 'UNAUTHORIZED':