csaf-crud 1.4.15

CSAF 2.0 / 2.1 advisory CRUD server with HATEOAS JSON API and HTML UI (TLS 1.3, HTTP/1.1 + HTTP/2 + HTTP/3)
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 Pierre Gronau, ndaal in Cologne

//! Error-page titles and validation/error message prose shared
//! across the CSAF CRUD handlers.

use crate::i18n::Entry;

/// Error-page titles and validation/error message prose shared across the
/// `create`/`view`/`edit_form`/`update`/`delete`/`json_download` handlers.
///
/// Every string that embeds a dynamic value (a tracking ID, a count) keeps
/// its `{placeholder}` literally in the template; call sites substitute it
/// with `str::replace` after `html_escape`-ing the value, exactly as the
/// pre-i18n code escaped it before interpolating with `format!`. This
/// keeps word order correct per language (`format!`'s own placeholders are
/// compile-time literals, so they cannot reorder around a runtime-chosen
/// template).
pub(super) fn tr(key: &str) -> Option<Entry> {
    Some(match key {
        "csaf.err_back" => ("Back", "Zurück", "Retour", "Volver", "Indietro"),
        "csaf.err_title_create_failed" => (
            "Create Failed",
            "Erstellung fehlgeschlagen",
            "Échec de la création",
            "Error al crear",
            "Creazione non riuscita",
        ),
        "csaf.err_title_not_found" => (
            "Not Found",
            "Nicht gefunden",
            "Introuvable",
            "No encontrado",
            "Non trovato",
        ),
        "csaf.err_title_error" => ("Error", "Fehler", "Erreur", "Error", "Errore"),
        "csaf.err_title_duplicate" => (
            "Duplicate Document",
            "Dokument bereits vorhanden",
            "Document en double",
            "Documento duplicado",
            "Documento duplicato",
        ),
        "csaf.err_title_storage_error" => (
            "Storage Error",
            "Speicherfehler",
            "Erreur de stockage",
            "Error de almacenamiento",
            "Errore di archiviazione",
        ),
        "csaf.err_title_update_failed" => (
            "Update Failed",
            "Aktualisierung fehlgeschlagen",
            "Échec de la mise à jour",
            "Error al actualizar",
            "Aggiornamento non riuscito",
        ),
        "csaf.err_title_tracking_id_mismatch" => (
            "Tracking ID Mismatch",
            "Tracking-ID stimmt nicht überein",
            "ID de suivi non concordant",
            "El ID de seguimiento no coincide",
            "ID di tracciamento non corrispondente",
        ),
        "csaf.err_title_validation_failed" => (
            "Validation Failed",
            "Validierung fehlgeschlagen",
            "Échec de la validation",
            "Error de validación",
            "Convalida non riuscita",
        ),
        "csaf.err_title_delete_error" => (
            "Delete Error",
            "Fehler beim Löschen",
            "Erreur de suppression",
            "Error al eliminar",
            "Errore durante l'eliminazione",
        ),
        "csaf.err_form_error_prefix" => (
            "Form error:",
            "Formularfehler:",
            "Erreur de formulaire :",
            "Error de formulario:",
            "Errore del modulo:",
        ),
        "csaf.err_document_exists" => (
            "A document with tracking ID <strong>{tid}</strong> already exists.",
            "Ein Dokument mit der Tracking-ID <strong>{tid}</strong> existiert bereits.",
            "Un document avec l'ID de suivi <strong>{tid}</strong> existe déjà.",
            "Ya existe un documento con el ID de seguimiento <strong>{tid}</strong>.",
            "Esiste già un documento con ID di tracciamento <strong>{tid}</strong>.",
        ),
        "csaf.err_document_not_found" => (
            "Document <strong>{tid}</strong> does not exist.",
            "Dokument <strong>{tid}</strong> existiert nicht.",
            "Le document <strong>{tid}</strong> n'existe pas.",
            "El documento <strong>{tid}</strong> no existe.",
            "Il documento <strong>{tid}</strong> non esiste.",
        ),
        "csaf.err_tracking_id_mismatch" => (
            "URL tracking ID <strong>{url_id}</strong> does not match document tracking ID <strong>{doc_id}</strong>.",
            "Die Tracking-ID der URL <strong>{url_id}</strong> stimmt nicht mit der Tracking-ID des Dokuments <strong>{doc_id}</strong> überein.",
            "L'ID de suivi de l'URL <strong>{url_id}</strong> ne correspond pas à l'ID de suivi du document <strong>{doc_id}</strong>.",
            "El ID de seguimiento de la URL <strong>{url_id}</strong> no coincide con el ID de seguimiento del documento <strong>{doc_id}</strong>.",
            "L'ID di tracciamento dell'URL <strong>{url_id}</strong> non corrisponde all'ID di tracciamento del documento <strong>{doc_id}</strong>.",
        ),
        "csaf.err_validation_prefix" => (
            "Validation errors:",
            "Validierungsfehler:",
            "Erreurs de validation :",
            "Errores de validación:",
            "Errori di convalida:",
        ),
        "csaf.err_missing_document_id" => (
            "Missing document ID",
            "Fehlende Dokument-ID",
            "ID de document manquant",
            "Falta el ID del documento",
            "ID documento mancante",
        ),
        _ => return None,
    })
}