From 06da9c8f1503e3a588ee260cf74ca970459a183e Mon Sep 17 00:00:00 2001 From: macadminHU <51995175+macrobi@users.noreply.github.com> Date: Sat, 24 Oct 2026 23:59:34 +0200 Subject: [PATCH] HU1: document translation lookup and catalog tests Add concise documentation for the cached lookup and three localization regression tests. Documentation only; runtime code, translations and test assertions are unchanged. --- crates/ui-egui/src/i18n.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 0038833dc..ba06b27ab 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -4466,6 +4466,8 @@ pub fn tr<'a>(lang: &str, s: &'a str) -> &'a str { if text.trim().is_empty() { s } else { text } } +/// Looks up a label in lazily cached language tables, using the shared table where supported. +/// Unknown languages and missing keys keep the source text; `tr` also handles blank entries. fn lookup<'a>(lang: &str, s: &'a str) -> &'a str { static GERMAN: OnceLock> = OnceLock::new(); static JAPANESE: OnceLock> = OnceLock::new(); @@ -4695,6 +4697,8 @@ mod tests { } } + /// Checks Hungarian catalog integrity, context captions and count substitutions, including + /// English fallback and preservation of user-defined style and workspace names. #[test] fn hungarian_catalog_preserves_placeholders_context_and_counts() { let catalog: HashMap<_, _> = hu::TABLE.iter().copied().collect(); @@ -4737,6 +4741,8 @@ mod tests { assert_eq!(workspace_name("hu", "Saját munkaterület"), "Saját munkaterület"); } + /// Checks translated labels and source-text fallback, plus key uniqueness and nonempty rows + /// in the shared, Arabic, Brazilian Portuguese and Italian catalogs. #[test] fn translates_known_strings_and_keeps_the_rest() { assert_eq!(tr("de", "File"), "Datei"); @@ -4809,6 +4815,7 @@ mod tests { } } + /// Keeps quantity labels distinct from numeric values and checks translated Pages-panel captions. #[test] fn a_column_count_and_a_list_number_read_differently() { for (lang, count, numeral) in [