From a59d8533b78a789b144db5fe7420214dd09b26a8 Mon Sep 17 00:00:00 2001 From: Losminek <301412321+Losminek@users.noreply.github.com> Date: Sun, 11 Oct 2026 13:52:41 +0200 Subject: [PATCH] i18n: Czech joins the complete-message languages; Czech reads as Czech MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Czech is in COMPLETE_MESSAGES, so a new status or error message needs a cs.tsv row too. czech_reads_as_czech checks the vocabulary (Nástroj Pracovní plocha, Vzorník, Operace s cestami, Tah, Výplň), the three plural forms of a layer count, the axis context and a nested message; czech_plurals_have_three_forms now also runs every @plural row through trn for one, few and other counts. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/i18n/tests.rs | 42 +++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index f9464ed0..eb0d9ec8 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -801,6 +801,46 @@ fn spaced_catalogs_keep_the_spaces_around_fragments() { fn czech_plurals_have_three_forms() { let forms: Vec = [0, 1, 2, 4, 5, 11, 21].into_iter().map(plural_czech).collect(); assert_eq!(forms, [2, 0, 1, 1, 2, 2, 2]); + // Every Czech plural row has the three forms, and each count picks its own. + let (entries, _) = parse_entries(cs().0.source); + let mut count = 0; + for (ctx, src, translated) in entries { + if ctx != "@plural" { + continue; + } + count += 1; + let (one, other) = src.split_once('|').expect("one|other source"); + let forms: Vec<_> = translated.split('|').collect(); + assert_eq!(forms.len(), 3, "{src}"); + for (n, form) in [(1, 0), (2, 1), (4, 1), (0, 2), (5, 2), (11, 2), (21, 2), (u64::MAX, 2)] { + assert_eq!(trn(cs(), n, one, other), forms[form].replace("{n}", &n.to_string()), "{src}: {n}"); + } + } + assert!(count >= 13, "Czech plural rows missing"); +} + +/// Czech uses the vector-illustration vocabulary its users know, has three plural forms +/// (one/few/other), and translates the reason inside a message too. +#[test] +fn czech_reads_as_czech() { + for (en, want) in [ + ("Artboard Tool", "Nástroj Pracovní plocha"), + ("Swatches", "Vzorník"), + ("Pathfinder", "Operace s cestami"), + ("Stroke", "Tah"), + ("Fill", "Výplň"), + ("Direct Selection Tool", "Nástroj Přímý výběr"), + ("Save As…", "Uložit jako…"), + ("Undo", "Zpět"), + ] { + assert_eq!(tr(cs(), en), want); + } + for (n, word) in [(0, "vrstev"), (1, "vrstva"), (2, "vrstvy"), (4, "vrstvy"), (5, "vrstev"), (11, "vrstev")] { + assert_eq!(trn(cs(), n, "{n} Layer", "{n} Layers"), format!("{n} {word}")); + } + assert_eq!(tr_ctx(cs(), "axis", "Both"), "Obě"); + let nested = "command `object.group` is not available right now: nothing selected"; + assert_eq!(message(cs(), nested), "příkaz `object.group` nyní není k dispozici: nic není vybráno"); } #[test] @@ -955,7 +995,7 @@ fn align_reflect_and_shear_param_errors_are_translated() { } /// Languages whose catalogs cover every status and error message. -const COMPLETE_MESSAGES: &[&str] = &["de", "es", "fr", "it", "ja", "ru", "uk"]; +const COMPLETE_MESSAGES: &[&str] = &["cs", "de", "es", "fr", "it", "ja", "ru", "uk"]; /// Crates whose error and status messages reach the status bar. const MESSAGE_CRATES: &[&str] = &["ui-egui", "engine", "doc", "format", "svg", "pdf", "eps", "text", "plugins", "metafile", "cad", "trace"];