DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge #829: Polish UI language
aiongg16c2ac46c6a9
diff --cc ROADMAP.mdindex 8ed2a0351,0e704d21d..27ffae428--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -98,7 -99,7 +98,7 @@@ Interface strings translated, of 1,724| Korean | ko | none | 0% || Vietnamese | vi | none | 0% |- Also shipped: Czech (99%), Italian (85%), Ukrainian (83%).-Also shipped: Italian (85%), Ukrainian (83%), Polish (99%).++Also shipped: Czech (99%), Italian (85%), Ukrainian (83%), Polish (99%).## Upcomingdiff --cc crates/ui-egui/src/i18n.rsindex c93f3448e,bc5b95d39..4cefbcd39--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@@ -5,13 -4,10 +5,14 @@@use std::{collections::HashMap, sync::OnceLock};mod ar;+mod cs;+mod de;+mod fr;mod it;mod ja;+ mod pl;mod pt_br;+mod ru;mod uk;/// Supported interface languages: (code, name in that language).@@@ -26,8 -22,7 +27,9 @@@ pub const LANGUAGES: &[(&str, &str)] =("pt-br", "Português (Brasil)"),("it", "Italiano"),("uk", "Українська"),+ ("ru", "Русский"),+ ("cs", "Čeština"),+ ("pl", "Polski"),];/// English → [German, French, Spanish, Japanese, Simplified Chinese].@@@ -4100,9 -2870,7 +4102,10 @@@ pub fn tr<'a>(lang: &str, s: &'a str) -static UKRAINIAN: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();static PORTUGUESE_BR: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();static ITALIAN: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();+ static POLISH: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();+ static RUSSIAN: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();+ static CZECH: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();+ static FRENCH: OnceLock<HashMap<&'static str, &'static str>> = OnceLock::new();if lang == "ar" {return ARABIC.get_or_init(|| ar::TABLE.iter().copied().collect()).get(s).copied().unwrap_or(s);}@@@ -4160,35 -2910,10 +4166,35 @@@ pub(crate) fn ukrainian_catalog() -> Veuk::TABLE.iter().map(|(_, text)| *text).chain(uk::CONTEXT.iter().map(|(_, _, text)| *text)).collect()}-/// Count captions in Ukrainian and Polish put the category before the value so every count uses-/// a grammatical form; other languages keep the existing value-first caption.+#[cfg(test)]+pub(crate) fn russian_catalog() -> Vec<&'static str> {+ ru::TABLE.iter().map(|(_, text)| *text).chain(ru::CONTEXT.iter().map(|(_, _, text)| *text)).collect()+}+- /// Ukrainian and Russian have several plural forms, so their count captions put the category- /// before the value ("сторінок: 5", "страниц: 5") and every number stays grammatical; other- /// languages keep the existing value-first caption.++/// Ukrainian, Russian and Polish have several plural forms, so their count captions put the++/// category before the value ("сторінок: 5", "страниц: 5", "Strony: 5") and every number stays++/// grammatical; other languages keep the existing value-first caption.+pub fn category_first(lang: &str) -> bool {- matches!(lang, "uk" | "ru")++ matches!(lang, "uk" | "ru" | "pl")+}++/// Caption for a counted category, e.g. `count_label("ru", "pages", 5)` is "страниц: 5". Czech+/// picks the plural form for the count (1, 2–4, other).pub fn count_label(lang: &str, noun: &str, count: usize) -> String {- if matches!(lang, "uk" | "pl") { format!("{}: {count}", tr(lang, noun)) } else { format!("{count} {}", tr(lang, noun)) }+ if category_first(lang) {+ return format!("{}: {count}", tr(lang, noun));+ }+ if lang == "cs"+ && let Some((_, [one, few, other])) = cs::PLURALS.iter().find(|(key, _)| *key == noun)+ {+ let form = match count {+ 1 => one,+ 2..=4 => few,+ _ => other,+ };+ return format!("{count} {form}");+ }+ format!("{count} {}", tr(lang, noun))}/// Localize reserved built-in style names only; user-defined names are document data.@@@ -4244,17 -2959,11 +4250,20 @@@ mod testsfor (key, expected) in uk::TABLE {assert_eq!(tr("uk", key), *expected, "uk: {key}");}+ for (key, expected) in ru::TABLE {+ assert_eq!(tr("ru", key), *expected, "ru: {key}");+ }+ for (key, expected) in cs::TABLE {+ assert_eq!(tr("cs", key), *expected, "cs: {key}");+ }+ for (key, expected) in fr::TABLE {+ assert_eq!(tr("fr", key), *expected, "fr: {key}");+ }+ for (key, expected) in pl::TABLE {+ assert_eq!(tr("pl", key), *expected, "pl: {key}");+ }let unknown = String::from("A user-defined untranslated label");- for lang in ["cs", "uk", "ru", "ar", "pt-br", "it", "zh", "ja", "de", "fr", "es", "", "unknown"] {- for lang in ["pl", "uk", "ar", "pt-br", "it", "zh", "ja", "de", "fr", "es", "", "unknown"] {++ for lang in ["pl", "cs", "uk", "ru", "ar", "pt-br", "it", "zh", "ja", "de", "fr", "es", "", "unknown"] {assert!(std::ptr::eq(tr(lang, &unknown), unknown.as_str()));}}@@@ -4386,240 -3060,49 +4395,283 @@@assert_eq!(count_label("", "objects", 2), "2 objects");}+ #[test]+ fn russian_catalog_covers_existing_keys_and_preserves_placeholders() {+ let catalog: std::collections::HashMap<_, _> = ru::TABLE.iter().copied().collect();+ assert_eq!(catalog.len(), ru::TABLE.len(), "duplicate Russian keys");+ let mut keys = std::collections::HashSet::new();+ keys.extend(TABLE.iter().map(|(key, _)| *key));+ keys.extend(ar::TABLE.iter().map(|(key, _)| *key));+ keys.extend(pt_br::TABLE.iter().map(|(key, _)| *key));+ keys.extend(it::TABLE.iter().map(|(key, _)| *key));+ keys.extend(ja::TABLE.iter().map(|(key, _)| *key));+ keys.extend(uk::TABLE.iter().map(|(key, _)| *key));+ // A new English string falls back to English until it is translated, so only stale+ // entries (keys no catalog knows any more) fail.+ let stale: Vec<_> = catalog.keys().filter(|k| !keys.contains(*k)).collect();+ assert!(stale.is_empty(), "Russian entries for unknown keys: {stale:?}");+ let placeholders =+ |s: &str| s.split('{').skip(1).filter_map(|part| part.split_once('}').map(|(name, _)| name.to_owned())).collect::<Vec<_>>();+ for (key, translation) in ru::TABLE {+ assert!(!translation.trim().is_empty(), "empty {key}");+ assert_eq!(key.starts_with(' '), translation.starts_with(' '), "leading space: {key}");+ assert_eq!(key.ends_with(' '), translation.ends_with(' '), "trailing space: {key}");+ assert!(!translation.contains(['ґ', 'є', 'і', 'ї', 'Ґ', 'Є', 'І', 'Ї']), "Ukrainian letter in {key}");+ let mut source = placeholders(key);+ let mut translated = placeholders(translation);+ source.sort();+ translated.sort();+ assert_eq!(source, translated, "placeholders: {key}");+ }+ }++ #[test]+ fn russian_is_selectable_ltr_and_resolves_contexts_styles_and_menu_paths() {+ assert!(LANGUAGES.contains(&("ru", "Русский")));+ assert!(!is_rtl("ru"));+ assert_eq!(tr("ru", "File"), "Файл");+ assert_eq!(tr("ru", "Type"), "Текст");+ assert_eq!(tr("ru", "Spread"), "Разворот");+ assert_eq!(tr("ru", "Story"), "Материал");+ assert_eq!(tr("ru", "Unknown label"), "Unknown label");+ assert_eq!(tr_context("ru", "Columns", "table"), "Столбцы");+ assert_eq!(tr("ru", "Columns"), "Колонки");+ assert_eq!(tr_context("ru", "Group", "selection"), "Группа");+ assert_eq!(tr("ru", "Group"), "Сгруппировать");+ assert_eq!(tr_context("ru", "Custom caption", "custom"), "Custom caption");+ assert_eq!(tr("ru", "through"), "включительно");+ assert_eq!(tr("ru", "up to"), "не включая");+ assert_eq!(tr("ru", "Edit/Spelling"), "Редактирование/Орфография");+ assert_eq!(tr("ru", "Type/Insert Special Character/Quotation Marks"), "Текст/Вставить специальный символ/Кавычки");+ assert_eq!(style_name("ru", "[Basic Paragraph]"), "[Основной абзац]");+ assert_eq!(style_name("ru", "My layout style"), "My layout style");+ assert_eq!(workspace_name("ru", "Essentials"), "Основное");+ assert_eq!(workspace_name("ru", "My workspace"), "My workspace");+ // Fixed standard names stay identical.+ assert_eq!(tr("ru", "PDF/X-4"), "PDF/X-4");+ }++ #[test]+ fn russian_counts_use_category_captions_for_every_number() {+ assert!(category_first("ru") && category_first("uk") && !category_first("de") && !category_first(""));+ for n in [0, 1, 2, 4, 5, 11, 12, 21, 22, 25, 101, 111] {+ assert_eq!(count_label("ru", "pages", n), format!("страниц: {n}"));+ assert_eq!(count_label("ru", "objects", n), format!("объектов: {n}"));+ assert_eq!(count_label("ru", "errors", n), format!("ошибок: {n}"));+ let pages = tr("ru", "{pages} Pages in {spreads} Spreads").replace("{pages}", &n.to_string()).replace("{spreads}", &n.to_string());+ assert_eq!(pages, format!("Страниц: {n}; разворотов: {n}"));+ }+ }++ #[test]+ fn polish_catalog_covers_existing_keys_and_preserves_placeholders() {+ let catalog: HashMap<_, _> = pl::TABLE.iter().copied().collect();+ assert_eq!(catalog.len(), pl::TABLE.len(), "duplicate Polish keys");+ let mut keys = std::collections::HashSet::new();+ keys.extend(TABLE.iter().map(|(key, _)| *key));- for table in [ar::TABLE, pt_br::TABLE, ja::TABLE, it::TABLE, uk::TABLE] {++ for table in [ar::TABLE, pt_br::TABLE, ja::TABLE, it::TABLE, uk::TABLE, de::TABLE, fr::TABLE, ru::TABLE, cs::TABLE] {+ keys.extend(table.iter().map(|(key, _)| *key));+ }+ // A new English string falls back to English until it is translated; only stale entries fail.+ let stale: Vec<_> = catalog.keys().filter(|k| !keys.contains(*k)).collect();+ assert!(stale.is_empty(), "Polish entries for unknown keys: {stale:?}");+ let placeholders =+ |s: &str| s.split('{').skip(1).filter_map(|part| part.split_once('}').map(|(name, _)| name.to_owned())).collect::<Vec<_>>();+ for (key, translation) in pl::TABLE {+ assert!(!translation.trim().is_empty(), "empty {key}");+ let mut source = placeholders(key);+ let mut translated = placeholders(translation);+ source.sort();+ translated.sort();+ assert_eq!(source, translated, "placeholders: {key}");+ assert_eq!(key.ends_with('…'), translation.ends_with('…'), "ellipsis: {key}");+ }+ assert!(LANGUAGES.contains(&("pl", "Polski")));+ assert!(!is_rtl("pl"));+ assert_eq!(tr("pl", "File"), "Plik");+ assert_eq!(tr("pl", "New Document…"), "Nowy dokument…");+ assert_eq!(tr("pl", "Spread"), "Rozkładówka");+ assert_eq!(tr("pl", "Unknown label"), "Unknown label");+ assert_eq!(style_name("pl", "[Basic Paragraph]"), "[Podstawowy akapit]");+ assert_eq!(workspace_name("pl", "Essentials"), "Podstawowe");+ }++ #[test]+ fn polish_counts_use_category_captions_for_every_number() {+ for n in [0, 1, 2, 5, 12, 22, 25] {+ assert_eq!(count_label("pl", "pages", n), format!("Strony: {n}"));+ assert_eq!(count_label("pl", "objects", n), format!("Obiekty: {n}"));+ assert_eq!(count_label("pl", "errors", n), format!("Błędy: {n}"));+ }+ assert_eq!(tr("pl", "{pages} Pages in {spreads} Spreads"), "Strony: {pages}, rozkładówki: {spreads}");+ }++ #[test]+ fn czech_catalog_has_no_stale_keys_and_keeps_placeholders_and_markers() {+ let catalog: HashMap<_, _> = cs::TABLE.iter().copied().collect();+ assert_eq!(catalog.len(), cs::TABLE.len(), "duplicate Czech keys");+ let mut keys = std::collections::HashSet::new();+ keys.extend(TABLE.iter().map(|(key, _)| *key));+ for table in [ar::TABLE, it::TABLE, ja::TABLE, pt_br::TABLE, uk::TABLE] {+ keys.extend(table.iter().map(|(key, _)| *key));+ }+ // Command labels and menu names reach `tr` from the engine and the UI command table.+ for spec in designcraft_engine::command_specs() {+ keys.insert(spec.label);+ keys.extend(spec.menu.iter().copied());+ }+ keys.extend(crate::menus::UI_COMMANDS.iter().map(|(_, label, _, _)| *label));+ // Tool names reach `tr` from the Tools panel.+ keys.extend(designcraft_tools::TOOL_GROUPS.iter().flat_map(|group| group.iter()).map(|tool| tool.label));+ // So do the About window's tab names, app descriptions and the credits' column and sort labels.+ keys.extend(crate::about::ABOUT_TABS);+ keys.extend(crate::about::SIBLINGS.iter().map(|(_, _, what)| *what));+ keys.extend(crate::credits::NameMode::ALL.iter().map(|mode| mode.label()));+ keys.extend(crate::credits::SortKey::ALL.iter().flat_map(|key| [key.label().0, key.label().1]));+ // UI labels passed to `tr` that no other catalog has yet.+ keys.extend([+ "(any)",+ "(unchanged)",+ "[No Language]",+ "Cell Number:",+ "Change fill to:",+ "Chinese: Simplified",+ "Chinese: Traditional",+ "Don't Save",+ "Email Address:",+ "Email:",+ "Find fill:",+ "Group with",+ "H:",+ "Message:",+ "Organization:",+ "Phone:",+ "W:",+ "Resize panel window",+ "Resize panels",+ "Subject:",+ "Text:",+ "Unsaved Changes",+ "“{}” has changes that are not saved. Save them before closing?",+ "% of all commits",+ "{count} conflict(s): {names}",+ "{count} match(es)",+ "{count} replacement(s) made",+ "{contributors} contributors · {commits} commits",+ "{label}: {name} (double-click: Color Picker)",+ "All",+ "Align To",+ "Auto Rename",+ "Character Style",+ "Company",+ "DesignCraft page",+ "Equal fixed heights for the selected rows; cell text may become overset.",+ "Found",+ "Grab bag",+ "Key Object",+ "layer",+ "layers",+ "Lines +/−",+ "New Cell Style",+ "New Table Style",+ "No contributor data was built into this copy.",+ "No matches",+ "No model credits were built into this copy.",+ "Object Style",+ "Paragraph Style",+ "Press keys…",+ "Range:",+ "Redefine Document Style",+ "Report an issue",+ "Reverse the order",+ "Story {story} ← story {parent}",+ "Story Editor — {count} words",+ "Text Anchor",+ "Use Document Style Definition",+ // Status-bar messages.+ "Alternate layout",+ "Couldn't write recovery data: {error}",+ "Export a PDF, IDML or package to share — no cloud account needed.",+ "Import cancelled: the originating document has closed",+ "Invalid panel layout; restored the default dock",+ "PDF import cancelled: the originating document has closed",+ "Packaged {count} files into {dir}",+ "Relinked {count}",+ "Sent {count} page(s) to {printer}",+ "the default printer",+ "{name}: import cancelled while a dialog is open; choose the file again",+ "{name}: {count} step(s) done",+ ]);+ // A new English string falls back to English until it is translated, so only stale+ // entries (keys nothing passes to `tr` any more) fail.+ let stale: Vec<_> = catalog.keys().filter(|k| !keys.contains(*k)).collect();+ assert!(stale.is_empty(), "Czech entries for unknown keys: {stale:?}");+ let placeholders =+ |s: &str| s.split('{').skip(1).filter_map(|part| part.split_once('}').map(|(name, _)| name.to_owned())).collect::<Vec<_>>();+ for (key, translation) in cs::TABLE {+ assert!(!translation.trim().is_empty(), "empty {key}");+ let mut source = placeholders(key);+ let mut translated = placeholders(translation);+ source.sort();+ translated.sort();+ assert_eq!(source, translated, "placeholders: {key}");+ // Dialog ellipses, label colons and padded button captions stay as in English.+ assert_eq!(key.ends_with('…'), translation.ends_with('…'), "ellipsis: {key}");+ assert_eq!(key.ends_with(':'), translation.ends_with(':'), "colon: {key}");+ assert_eq!(key.starts_with(' '), translation.starts_with(' '), "leading space: {key}");+ assert_eq!(key.ends_with(' '), translation.ends_with(' '), "trailing space: {key}");+ }+ assert!(!is_rtl("cs"));+ assert_eq!(tr("cs", "File"), "Soubor");+ assert_eq!(tr("cs", "New Document…"), "Nový dokument…");+ assert_eq!(tr("cs", "Spread"), "Dvoustrana");+ assert_eq!(tr("cs", "Bleed"), "Spadávka");+ assert_eq!(tr("cs", "Leading"), "Proklad");+ assert_eq!(tr("cs", "Unknown label"), "Unknown label");+ assert_eq!(tr_context("cs", "Group", "selection"), "Skupina");+ assert_eq!(tr_context("cs", "Name", "contributors"), "Jméno");+ assert_eq!(tr_context("cs", "Name", "unknown"), "Název");+ assert_eq!(tr("cs", "Group"), "Seskupit");+ assert_eq!(tr_context("cs", "Columns", "table"), tr("cs", "Columns"));+ assert_eq!(style_name("cs", "[Basic Paragraph]"), "[Základní odstavec]");+ assert_eq!(style_name("cs", "My layout style"), "My layout style");+ assert_eq!(workspace_name("cs", "Essentials"), "Základní");+ assert_eq!(workspace_name("cs", "My workspace"), "My workspace");+ }++ #[test]+ fn czech_counts_use_the_plural_form_for_the_number() {+ for (n, form) in [(0, "chyb"), (1, "chyba"), (2, "chyby"), (4, "chyby"), (5, "chyb"), (11, "chyb"), (22, "chyb")] {+ assert_eq!(count_label("cs", "errors", n), format!("{n} {form}"));+ }+ // The status bar passes the singular noun for one error.+ assert_eq!(count_label("cs", "error", 1), "1 chyba");+ assert_eq!(count_label("cs", "pages", 1), "1 stránka");+ assert_eq!(count_label("cs", "pages", 3), "3 stránky");+ assert_eq!(count_label("cs", "pages", 5), "5 stránek");+ assert_eq!(count_label("cs", "stories", 2), "2 články");+ assert_eq!(count_label("cs", "items", 1), "1 položka");+ assert_eq!(count_label("cs", "objects", 7), "7 objektů");+ assert_eq!(count_label("cs", "warnings", 3), "3 varování");+ assert_eq!(count_label("cs", "layer", 1), "1 vrstva");+ assert_eq!(count_label("cs", "layers", 3), "3 vrstvy");+ assert_eq!(count_label("cs", "layers", 8), "8 vrstev");+ // A noun without plural forms keeps the plain translation.+ assert_eq!(count_label("cs", "a new noun", 3), "3 a new noun");+ for (noun, forms) in cs::PLURALS {+ assert!(forms.iter().all(|form| !form.is_empty()), "{noun}");+ assert!(forms.contains(&tr("cs", noun)), "{noun}: the catalog row is one of the plural forms");+ }+ }++ #[test]+ fn czech_translates_every_tool_name() {+ for tool in designcraft_tools::TOOL_GROUPS.iter().flat_map(|group| group.iter()) {+ assert_ne!(tr("cs", tool.label), tool.label, "{}", tool.id);+ assert_eq!(tr("", tool.label), tool.label);+ }+ }+#[test]fn japanese_vertical_type_commands_are_translated() {for (en, ja) in [diff --cc crates/ui-egui/src/menus.rsindex 4660189c8,660977cbb..c5ae1a25d--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@@ -3481,50 -2810,37 +3481,70 @@@ mod testsassert_eq!(restored.language, "uk");assert_eq!(crate::i18n::tr(&restored.language, "File"), "Файл");assert_eq!(crate::i18n::tr(&restored.language, "A custom name"), "A custom name");- assert!(menu_tree().iter().flat_map(|(_, entries)| entries.iter()).any(|entry| {- matches!(entry, Item::Sub(label, children) if label == "Interface Language" && children.iter().any(|child| {- matches!(child, Item::Cmd { label, id, params, .. } if label == "Українська" && id == "app.language" && params["lang"] == "uk")- }))- }));+ assert!(crate::i18n::LANGUAGES.contains(&("uk", "Українська")), "Preferences lists Ukrainian by its own name");+ }++ #[test]+ fn russian_language_is_selectable_persisted_and_keeps_document_data() {+ let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({"pages": 4, "facingPages": true})).unwrap();+ app.run("frame.create", json!({"rect": [36, 36, 200, 200], "content": "text", "text": "My words · Мои слова"})).unwrap();+ let before = serde_json::to_value(&app.session.doc().unwrap().doc).unwrap();+ run_ui(&mut app, "app.language", &json!({"lang": "ru"})).unwrap().unwrap();+ assert_eq!(checked(&app, "app.language", &json!({"lang": "ru"})), Some(true));+ assert_eq!(before, serde_json::to_value(&app.session.doc().unwrap().doc).unwrap());+ for (title, _) in menu_tree() {+ assert_ne!(crate::i18n::tr("ru", title), title, "{title}");+ }+ let bytes = serde_json::to_vec(&app.ui).unwrap();+ let restored: crate::UiState = serde_json::from_slice(&bytes).unwrap();+ assert_eq!(restored.language, "ru");+ assert_eq!(crate::i18n::tr(&restored.language, "File"), "Файл");+ assert_eq!(crate::i18n::tr(&restored.language, "A custom name"), "A custom name");+ assert!(crate::i18n::LANGUAGES.contains(&("ru", "Русский")), "Preferences lists Russian by its own name");+ }++ #[test]+ fn czech_language_is_selectable_persisted_and_keeps_document_data() {+ let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({"pages": 4, "facingPages": true})).unwrap();+ app.run("frame.create", json!({"rect": [36, 36, 200, 200], "content": "text", "text": "My words · Příliš žluťoučký kůň"})).unwrap();+ let before = serde_json::to_value(&app.session.doc().unwrap().doc).unwrap();+ run_ui(&mut app, "app.language", &json!({"lang": "cs"})).unwrap().unwrap();+ assert_eq!(app.ui.language, "cs");+ assert_eq!(checked(&app, "app.language", &json!({"lang": "cs"})), Some(true));+ assert_eq!(before, serde_json::to_value(&app.session.doc().unwrap().doc).unwrap());+ for (title, _) in menu_tree() {+ assert_ne!(crate::i18n::tr("cs", title), title, "{title}");+ }+ let bytes = serde_json::to_vec(&app.ui).unwrap();+ let restored: crate::UiState = serde_json::from_slice(&bytes).unwrap();+ assert_eq!(restored.language, "cs");+ assert_eq!(crate::i18n::tr(&restored.language, "File"), "Soubor");+ assert_eq!(crate::i18n::tr(&restored.language, "A custom name"), "A custom name");+ assert!(crate::i18n::LANGUAGES.contains(&("cs", "Čeština")), "Preferences lists Czech by its own name");}+ #[test]+ fn polish_language_is_selectable_persisted_and_keeps_document_data() {+ let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({"pages": 2, "facingPages": true})).unwrap();+ app.run("frame.create", json!({"rect": [36, 36, 200, 200], "content": "text", "text": "Zażółć gęślą jaźń"})).unwrap();+ let before = serde_json::to_value(&app.session.doc().unwrap().doc).unwrap();+ run_ui(&mut app, "app.language", &json!({"lang": "pl"})).unwrap().unwrap();+ assert_eq!(app.ui.language, "pl");+ assert_eq!(checked(&app, "app.language", &json!({"lang": "pl"})), Some(true));+ assert_eq!(before, serde_json::to_value(&app.session.doc().unwrap().doc).unwrap());+ for (title, _) in menu_tree() {+ assert_ne!(crate::i18n::tr("pl", title), title, "{title}");+ }+ let bytes = serde_json::to_vec(&app.ui).unwrap();+ let restored: crate::UiState = serde_json::from_slice(&bytes).unwrap();+ assert_eq!(restored.language, "pl");+ assert_eq!(crate::i18n::tr(&restored.language, "File"), "Plik");- assert!(menu_tree().iter().flat_map(|(_, entries)| entries.iter()).any(|entry| {- matches!(entry, Item::Sub(label, children) if label == "Interface Language" && children.iter().any(|child| {- matches!(child, Item::Cmd { label, id, params, .. } if label == "Polski" && id == "app.language" && params["lang"] == "pl")- }))- }));++ assert!(crate::i18n::LANGUAGES.contains(&("pl", "Polski")), "Preferences lists Polish by its own name");+ }+#[test]fn arabic_dialog_and_language_switch_keep_finite_widget_geometry() {let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());@@@ -3552,7 -2868,7 +3572,7 @@@crate::dialogs::confirm(&mut app).unwrap();frame(&mut app);assert_eq!(app.session.documents().len(), 1);- for lang in ["uk", "ru", "zh", "", "ar", "pt-br", "it", "cs"] {- for lang in ["uk", "zh", "", "ar", "pt-br", "it", "pl"] {++ for lang in ["uk", "ru", "zh", "", "ar", "pt-br", "it", "cs", "pl"] {app.run("app.language", json!({"lang": lang})).unwrap();frame(&mut app);}diff --cc docs/localization-parity.mdindex 73f3e85a0,3cd814fa6..88e938e46--- a/docs/localization-parity.md+++ b/docs/localization-parity.md@@@ -1,6 -1,6 +1,6 @@@# Localization parity- > **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-11 · **Change:** minor (Japanese print, import and table controls localized; catalog counts remain the 2026-10-10 measurement) · **Target:** Adobe InDesign 2026 (21.6)-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (Polish interface) · **Target:** Adobe InDesign 2026 (21.6)++> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-13 · **Change:** minor (Polish interface; catalog counts remain the 2026-10-10 measurement) · **Target:** Adobe InDesign 2026 (21.6)Per-language status of the DesignCraft interface and of document typesetting in each script.Script-specific typesetting detail: [cjk.md](cjk.md), [cjk-typography.md](cjk-typography.md),@@@ -52,11 -47,11 +52,12 @@@ craft-fonts. The language totals above| Language | Code | UI strings translated | Status ||---|---|---|---|+| Czech | cs | 1,722 (99%), plural categories handled | partial || Italian | it | 1,464 (85%) | partial || Ukrainian | uk | 1,432 (83%), plural categories handled | partial |+ | Polish | pl | 1,717 (99%), count captions category-first; AI-drafted, awaiting native review | partial |--DesignCraft ships **3** interface languages beyond the twelve; InDesign ships 17 beyond its++DesignCraft ships **4** interface languages beyond the twelve; InDesign ships 17 beyond itseight of the twelve (cs, da, el, en_GB, fi, hu, it, nb, nl, pl, ro, ru, sq, sv, tr, uk, zh_TW).## Document languages@@@ -83,6 -78,5 +84,7 @@@ locale shaping. See [typography-parity.| Date | Change | Summary ||---|---|---|+| 2026-10-11 | minor | Localized Japanese print, import and table controls; checked Japanese and English renders || 2026-10-10 | major | Created: catalogs measured (1,724 strings), the twelve key languages plus Italian and Ukrainian |+| 2026-10-11 | minor | Czech (cs) added: 1,722 strings, plural categories handled |+ | 2026-10-13 | minor | Polish interface added (1,717 strings) |diff --cc docs/target-app-parity.mdindex 1e2d465dc,7203e387f..f0c9173e9--- a/docs/target-app-parity.md+++ b/docs/target-app-parity.md@@@ -373,16 -365,16 +373,16 @@@ It is evidence of breadth: each item ex- Split Window / New Window (`window.split`, `window.newWindow`, Window ▸ Arrange): two side-by-side views of the document with their own zoom, scroll and render cache. New Window puts the second view in its own OS window (an egui viewport; a floating window on the web).- Transparency flattener (`file.exportPdf {flatten: high|medium|low|ppi}`, Edit ▸ Transparency Flattener Presets): each object involving transparency becomes an opaque image of its area over what's beneath it, so everything else stays vector (spreads with transparent parent items are rasterised whole).- Video and sound (place .mp4/.mov/.webm/.mp3/.wav…, `media.options/get`, Media panel): media frames show a poster or placeholder on screen, in print and in PDF, and export as HTML5 `<video>`/`<audio>` in EPUB. Interactive PDF export (`file.exportPdf {media: true}`, File ▸ Export PDF (Interactive)) embeds each file and plays it in a Screen annotation through a rendition action (controls, loop, play on page load). No in-app playback.-- Right-to-left text (World-Ready basics): right-to-left runs are shaped right to left, lines are reordered by the Unicode Bidirectional Algorithm (matched against the reference implementation), Paragraph Direction (`type.para {direction}`, Paragraph panel, IDML ParagraphDirection, EPUB `dir`). Digits (`digits`: Default, Arabic, Hindi, Farsi, Native by language; Character panel for right-to-left text; IDML DigitsType) draw 0–9 in another script. Kashidas (`kashidas` paragraph attribute, on by default): justified Arabic lines stretch at one join per word (after seen/sad when possible, never inside lam–alef) with a drawn tatweel before word spaces widen. Carets follow the drawing: the caret before a right-to-left glyph sits at its right edge, arrow keys move as drawn (by words in the line's direction), clicks find the nearest drawn caret position and selections highlight the selected glyphs. Binding: Right to Left (Document Setup, `layout.documentSetup {binding}`, IDML PageBinding) makes page 1 a left page and lays spreads out right to left.-- Interface language (Edit ▸ Interface Language, `app.language`): German, French, Spanish, Italian, Japanese, Simplified Chinese and Arabic menu titles, common menu items and panel names (our own translations). Common dialog, panel and tooltip labels are also localized, with English fallback for untranslated strings. Arabic translations cover every key in the shared interface translation table, including menu commands and utility labels. The Type menu's Story Direction, Horizontal/Vertical, Tate-Chu-Yoko, Ruby… and Kenten are translated too. Arabic labels use Unicode bidi run ordering and contextual shaping; welcome and new-document form layouts follow RTL direction independently of document binding. CJK and Arabic glyphs come from [craft-fonts](https://github.com/storytold/craft-fonts) when built with `CRAFT_FONTS_DIR` (all releases): BIZ UDPGothic and Noto Sans CJK SC for the UI (Chinese forms first in the Chinese interface), Noto Sans Arabic, and Mincho for Japanese documents (the web build embeds BIZ UDPGothic only); otherwise from system fonts. Ukrainian covers all 1,430 existing catalog keys, including publishing dialogs and built-in names, with persisted selection, grammatical count captions, English fallback and bundled Cyrillic UI glyph coverage. Polish covers 1,717 catalog keys with the same category-first count captions and English fallback.+- Right-to-left text (World-Ready basics): right-to-left runs are shaped right to left, lines are reordered by the Unicode Bidirectional Algorithm (matched against the reference implementation), Paragraph Direction (`type.para {direction}`, Paragraph panel, IDML ParagraphDirection, EPUB `dir`). Digits (`digits`: Default, Arabic, Hindi, Farsi, Native by language; Character panel for right-to-left text; IDML DigitsType) draw 0–9 in another script. Kashidas (`kashidas` paragraph attribute, on by default; IDML Kashidas): justified Arabic lines stretch at one join per word (after seen/sad when possible, never inside lam–alef) with a drawn tatweel before word spaces widen. Carets follow the drawing: the caret before a right-to-left glyph sits at its right edge, arrow keys move as drawn (by words in the line's direction), clicks find the nearest drawn caret position and selections highlight the selected glyphs. Binding: Right to Left (Document Setup, `layout.documentSetup {binding}`, IDML PageBinding) makes page 1 a left page and lays spreads out right to left.- - Interface language (Preferences ▸ General ▸ Interface Language, `app.language`; each language listed by its own name): German, French, Spanish, Italian, Japanese, Simplified Chinese and Arabic menu titles, common menu items and panel names (our own translations). Common dialog, panel and tooltip labels are also localized, with English fallback for untranslated strings. Arabic translations cover every key in the shared interface translation table, including menu commands and utility labels. The Type menu's Story Direction, Horizontal/Vertical, Tate-Chu-Yoko, Ruby… and Kenten are translated too. Arabic labels use Unicode bidi run ordering and contextual shaping; welcome and new-document form layouts follow RTL direction independently of document binding. CJK and Arabic glyphs come from [craft-fonts](https://github.com/storytold/craft-fonts) when built with `CRAFT_FONTS_DIR` (all releases): BIZ UDPGothic and Noto Sans CJK SC for the UI (Chinese forms first in the Chinese interface), Noto Sans Arabic, and Mincho for Japanese documents (the web build embeds BIZ UDPGothic only); otherwise from system fonts. Ukrainian covers all 1,430 existing catalog keys, including publishing dialogs and built-in names, with persisted selection, grammatical count captions, English fallback and bundled Cyrillic UI glyph coverage.++- Interface language (Preferences ▸ General ▸ Interface Language, `app.language`; each language listed by its own name): German, French, Spanish, Italian, Japanese, Simplified Chinese and Arabic menu titles, common menu items and panel names (our own translations). Common dialog, panel and tooltip labels are also localized, with English fallback for untranslated strings. Arabic translations cover every key in the shared interface translation table, including menu commands and utility labels. The Type menu's Story Direction, Horizontal/Vertical, Tate-Chu-Yoko, Ruby… and Kenten are translated too. Arabic labels use Unicode bidi run ordering and contextual shaping; welcome and new-document form layouts follow RTL direction independently of document binding. CJK and Arabic glyphs come from [craft-fonts](https://github.com/storytold/craft-fonts) when built with `CRAFT_FONTS_DIR` (all releases): BIZ UDPGothic and Noto Sans CJK SC for the UI (Chinese forms first in the Chinese interface), Noto Sans Arabic, and Mincho for Japanese documents (the web build embeds BIZ UDPGothic only); otherwise from system fonts. Ukrainian covers all 1,430 existing catalog keys, including publishing dialogs and built-in names, with persisted selection, grammatical count captions, English fallback and bundled Cyrillic UI glyph coverage. Polish covers 1,717 catalog keys with the same category-first count captions and English fallback.- Page transitions (`page.transition/transitions`, Page Transitions panel): twelve transition types with speed and direction per spread, written into exported PDFs as `/Trans` entries through an incremental update.-- PDF/X-4 export (`file.exportPdf {standard: "x4"}`): an output intent with our own Generic CMYK ICC profile (lut16 tables generated from the parametric press model), GTS_PDFXVersion in Info and XMP, `pdf:Trapped` in XMP as in Info, RGB images without a profile tagged sRGB, no image interpolation (none in PDF/A either), and built-in PDF/X-4 checks reported as warnings. qpdf finds no errors in the result.+- PDF/X-4 export (`file.exportPdf {standard: "x4"}`): an output intent with the working CMYK space's profile (by default craft-cms's Coated FOGRA39 profile, identifier FOGRA39; Generic CMYK and Device CMYK embed our Generic CMYK profile, lut16 tables generated from the parametric press model), GTS_PDFXVersion in Info and XMP, `pdf:Trapped` in XMP as in Info, RGB images without a profile tagged sRGB, no image interpolation (none in PDF/A either), and built-in PDF/X-4 checks reported as warnings. qpdf finds no errors in the result.- EPS place: placed at its (high-resolution) bounding box and shown, printed and exported through its TIFF preview, or a placeholder when it has none. PostScript itself isn't interpreted.- Preferences: Dictionary (user dictionary; `spelling.setWords/words`), Spelling (Dynamic Spelling: red squiggles on the canvas, also Edit ▸ Spelling), Autocorrect (word list, applied as you type), Notes, Track Changes, Story Editor Display and File Handling (recovery interval) sections.-- Colour management exposed: Edit ▸ Color Settings (`color.settings`: RGB/CMYK working spaces, intent, black-point compensation; `color.loadProfile` for ICC files; `color.convert` through the working spaces, with gamut checks) and View ▸ Proof Setup / Proof Colors (press, sRGB, legacy Mac RGB, colour-blindness simulations, simulate paper) on the canvas.+- Colour management exposed (ICC through the craft-libs `craft-cms` crate): Edit ▸ Color Settings (`color.settings`: RGB/CMYK working spaces, default CMYK Coated FOGRA39 with CMYK swatches shown relative colorimetric with black-point compensation, Generic CMYK and Device CMYK still selectable, intent, black-point compensation; `color.loadProfile` for ICC files; `color.convert` through the working spaces, with gamut checks) and View ▸ Proof Setup / Proof Colors (press, sRGB, legacy Mac RGB, colour-blindness simulations, simulate paper) on the canvas. Placed images are shown through their embedded ICC profiles, and CMYK images through their own profile or the working CMYK space, with the settings' intent and black-point compensation.- Keyboard: Tab / Shift+Tab hide and show all panels / all but Tools (`window.hidePanels`, `window.hidePanelsExceptTools`); Cmd+F6 / Cmd+Shift+F6 cycle documents; panel fields are reached with Tab and Escape returns to the layout.-- Smart guides and snapping (View ▸ Snap to Guides / Snap to Document Grid / Smart Guides, `view.snapPreferences` and Preferences ▸ Guides & Pasteboard): moving, drawing, resizing, rotating and pen/anchor drags snap in order to the document and baseline grids, ruler guides, margins and columns, other objects' edges and centres (parent-page items too, by visible stroked bounds), equal spacing, matching dimensions and matching rotation, with guides, gap marks and measurements drawn on the canvas. Shift and Cmd constrain the gesture.-- View ▸ Rotate Spread (`view.rotateSpread`, `layout.rotateSpreadView`): the spread in view turns in quarter turns on screen (stored with the document; output is unaffected). The canvas maps each spread through its own transform, so tools, snapping, resize handles, guides, overlays and rendering all follow the turned spread.+- Smart guides and snapping (View ▸ Snap to Guides / Snap to Document Grid / Smart Guides, `view.snapPreferences` and Preferences ▸ Guides & Pasteboard): moving, drawing, resizing, rotating and pen/anchor drags snap in order to the document grid, ruler guides (a page's own and its parent page's), margins and columns, other objects' edges and centres (parent-page items too, by visible stroked bounds), equal spacing (centred between two neighbours too), matching dimensions, the baseline grid and matching rotation, with guides, gap marks and measurements drawn on the canvas. Shift and Cmd constrain the gesture.+- View ▸ Rotate Spread (`view.rotateSpread`, `layout.rotateSpreadView`): the spread in view turns in quarter turns on screen (stored with the document and in IDML's spread transform; output is unaffected). The canvas maps each spread through its own transform, so tools, snapping, resize handles, guides, overlays and rendering all follow the turned spread.- Vertical type (Vertical Type Tool, Type ▸ Story Direction `type.storyDirection`, IDML StoryOrientation): the direction belongs to the story, so every frame of a thread is vertical or horizontal together and a frame threaded onto a story takes its direction (`object.textFrameOptions {vertical}` sets the frames' stories); lines run top to bottom and follow each other right to left; the arrow keys follow them (Down and Up along the line, Left and Right to the next and previous line, keeping the position along it); CJK characters stay upright and other text turns, on screen and in PDF; CJK line breaking with basic kinsoku (also in horizontal text); Korean breaks at spaces, word by word (Hangul in any language, hanja in Korean text), or between syllables when the paragraph asks for it (`type.para {koreanCharBreaks}`, Paragraph Style Options ▸ Justification; not written to IDML). Upright text is shaped top to bottom: punctuation and brackets take their vertical forms (OpenType `vert`; `vkrn` and `vpal` through OpenType features), glyphs advance by their vertical metrics (`vmtx`) and hang from their vertical origins (`VORG`) on the centre of the ideographic em box (`BASE`, else OS/2), which the first line's ascent follows; turned text keeps its horizontal forms. Tate-chu-yoko (Type ▸ Tate-Chu-Yoko, `type.tateChuYoko`, IDML `Tatechuyoko`) sets a run such as "12" side by side within one em of the line. Ruby (Type ▸ Ruby…, `type.ruby`, IDML RubyString; group ruby spread 1-2-1 or centred) and kenten emphasis dots (`type.kenten`, IDML KentenKind) are set over their text — to its right in vertical frames — without changing line breaks. Warichu and ruby options (per-character ruby, positions, overhang) aren't there yet.- Math expressions (Type ▸ Insert Math Expression…, `math.insert`, `math.svg`): a LaTeX subset (fractions, scripts, roots, big operators with limits, Greek, relations and operators with math spacing, `\left…\right`, `\text`) typeset by our own engine into SVG, placed inline at the cursor or as a frame; the LaTeX is kept as alt text and can be edited.- Object Layer Options for placed PDFs (`object.pdfLayers`, `object.layerOptions`, Object ▸ Object Layer Options…): the file's optional-content layers listed and shown or hidden per frame on screen; in exported PDFs such graphics go out as 300 ppi images of their visible layers.