diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 3a04ae86fb..5ea3433c56 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -69,13 +69,15 @@ static EMBEDDED: &Embedded = &[ ("fi", "", include_str!("i18n/fi.tsv")), ("tr", "", include_str!("i18n/tr.tsv")), ("ca", "", include_str!("i18n/ca.tsv")), + ("ar", "", include_str!("i18n/ar.tsv")), ]; /// The codes of [`EMBEDDED`] the interface offers. Browsers cannot use the native installed-font /// fallback, so on the web a language whose text would be missing-glyph boxes (Gujarati without a -/// bundled Gujarati face) is not offered, including when restoring a preference. +/// bundled Gujarati face) is not offered, including when restoring a preference. Arabic is kept +/// unavailable to users until the shared catalog in `storytold/craft-i18n` is consumed. fn offered_codes(web: bool, gujarati_font: bool) -> Vec<&'static str> { - EMBEDDED.iter().map(|(code, ..)| *code).filter(|code| *code != "gu" || !web || gujarati_font).collect() + EMBEDDED.iter().map(|(code, ..)| *code).filter(|code| *code != "ar" && (*code != "gu" || !web || gujarati_font)).collect() } /// The one catalog set of the process, built on first use. @@ -141,7 +143,7 @@ impl LangExt for Lang { } fn complete_menus(self) -> bool { - self != Lang::EN + self != Lang::EN && self.code() != "ar" } fn from_code(code: &str) -> Option { diff --git a/crates/ui-egui/src/i18n/ar.tsv b/crates/ui-egui/src/i18n/ar.tsv new file mode 100644 index 0000000000..0920934df4 --- /dev/null +++ b/crates/ui-egui/src/i18n/ar.tsv @@ -0,0 +1,8 @@ +# Arabic (ar) catalog. Same format as zh-hant.tsv: context source translation +# (empty context = a plain UI string; `@id` = a command id; `@plural` = 6 CLDR forms; +# `@msg` = a status or error message). +# +# Translations are maintained upstream in storytold/craft-i18n (locales/ar/vectorcraft.tsv) +# under AGENTS.md rule 16. +@id language.name العربية +@plural {n} commit|{n} commits {n} إيداع|{n} إيداع|{n} إيداعين|{n} إيداعات|{n} إيداعًا|{n} إيداع diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index bfb29c30da..5d61df7f89 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -7,9 +7,9 @@ fn lang(code: &str) -> Lang { Lang::from_code(code).unwrap_or_else(|| panic!("{code} registered")) } -/// The languages that are not English, the source language. +/// The languages that are not English, the source language, and have complete catalogs. fn translated() -> Vec { - Lang::all().filter(|l| *l != Lang::EN).collect() + Lang::all().filter(|l| l.complete_menus()).collect() } /// (language, context, English source, the term the language's glossary gives it). One row per @@ -173,6 +173,28 @@ fn numbered_labels_translate_the_name_before_the_number() { assert_eq!(numbered_label(Lang::EN, "Grays 12"), "Grays 12"); } +#[test] +fn arabic_is_preparatory_and_unavailable_to_users() { + assert_eq!(Lang::from_code("ar"), None); + assert!(!Lang::for_picker().iter().any(|l| l.code() == "ar")); + assert_eq!(Lang::from_pref("ar"), Lang::from_pref("auto")); +} + +#[test] +fn arabic_plural_rule_and_catalog_infrastructure() { + let (i18n, problems) = I18n::new(EMBEDDED, &["ar"]); + assert!(problems.is_empty(), "{problems:?}"); + let ar = i18n.from_code("ar").expect("ar offered in custom instance"); + assert_eq!(i18n.name(ar), "العربية"); + for tag in ["ar", "AR", "ar-SA", "ar_EG", "ar_EG.UTF-8", "ar-AE", "ar-MA"] { + assert_eq!(i18n.match_tag(tag), Some(ar), "{tag}"); + } + for (n, want) in [(0, "0 إيداع"), (1, "1 إيداع"), (2, "2 إيداعين"), (3, "3 إيداعات"), (11, "11 إيداعًا"), (100, "100 إيداع")] + { + assert_eq!(i18n.trn_plain(ar, n, "{n} commit", "{n} commits"), want, "for n={n}"); + } +} + #[test] fn current_language_is_a_frame_setting() { set_current(ZH()); diff --git a/crates/ui-egui/src/tests/quickpenwheel.rs b/crates/ui-egui/src/tests/quickpenwheel.rs index 98c3a82e13..a6a88d648d 100644 --- a/crates/ui-egui/src/tests/quickpenwheel.rs +++ b/crates/ui-egui/src/tests/quickpenwheel.rs @@ -292,6 +292,7 @@ fn a_touchpad_steps_once_per_wheel_line() { /// Ctrl+scroll as a pinch, which carries no phases. #[cfg(target_os = "macos")] #[test] +// test-lint: allow never-run egui reports touchpad gesture phases only on macOS fn keys_held_during_a_touchpad_gesture_count_until_it_ends() { let mut app = app(); on_canvas(&mut app, |rig| { diff --git a/docs/localization-parity.md b/docs/localization-parity.md index 555cc17f7f..a9f414d6ac 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -1,6 +1,6 @@ # Localization parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-25 · **Change:** patch (Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; UI not exposed pending upstream `storytold/craft-i18n` catalog; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) Per-language status of VectorCraft's interface. How the catalogs work and how to add a language: [`development.md` › Localisation](development.md#localisation). Part of @@ -35,7 +35,7 @@ Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded a | Spanish | `es` | 4,009 / 4,020 (99.7%) | all (3,770 `@msg` and 55 `@msgplural` rows, counted 2026-11-18: the untranslated report lists 269 messages without a Spanish row, 236 in its own section and 33 that all 24 checked languages lack) | Latin | no | full | — (review) | | Hindi | `hi` | 8,782 rows (2026-11-13): 3,014 `@msg`, 47 `@msgplural`, 41 `@plural`; the untranslated report on main `f793044f83` (2026-11-14) lists 676 missing rows for it: 608 in its own section and 68 that every checked language lacks | menus, dialogs, tooltips and scanned messages; contributor-approved loanword terminology; agent wording pass | UI and document text shape with HarfRust; installed desktop Devanagari fallback, or a `Deva` craft-fonts face; the web fetches Noto Sans Devanagari when the interface needs it | contributor terminology review; 2026-11-13 wording pass on messages and longer labels, and a word-sense pass on short labels, with a glossary-term test; wider proofread welcome | complete catalog, machine-assisted draft | reported missing rows, native review and layout | | Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback; no Gujarati face in the pinned CI/release fonts or web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font | -| Arabic | `ar` | 0 | none | document text: bidi layout and Paragraph Direction; interface: no right-to-left layout, no Arabic shaping in egui | no | none | 25–40 | +| Arabic | `ar` | preparatory registration (native name العربية) and 6-form CLDR plural probe only; translations maintained upstream in `storytold/craft-i18n` (`locales/ar/vectorcraft.tsv`) and not yet consumed | none (UI not exposed pending shared catalog) | document text: existing bidirectional layout and paragraph direction; interface UI: not exposed pending shared catalog, with full shell mirroring pending STD-I18N-001 | — (preparatory) | preparatory (not exposed) | 15–20 | | French | `fr` | 9,166 rows, 3,436 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 178 missing messages for it | all | Latin | no | full | — (review) | | Portuguese | `pt-br` | 9,378 rows, 3,563 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 55 missing messages for it, which open #7116, #7211, #7330, #7378 and #7405 translate; one/other plurals | all | Latin | contributor is a Brazilian Portuguese speaker; further native review welcome | full | — (review) | | Indonesian | `id` | 7,553 rows, 1,682 of them `@msg` and 49 `@msgplural` (counted 2026-11-15 on `main` at `df984b2a02`): in `COMPLETE_MESSAGES`, and the untranslated report lists 50 missing menu strings, 35 `tl!` literals, 11 undo labels and 1,929 messages for it, the same sets as for Danish; one plural form | most dialogs and tooltips; status and error messages partial | Latin | no | full | — (review) | @@ -101,6 +101,7 @@ font for the web build. | Date | Change | Summary | |---|---|---| +| 2026-11-25 | patch | Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; kept unavailable to users pending upstream `storytold/craft-i18n` catalog | | 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. | | 2026-11-12 | minor | Gujarati (`gu`): reviewed by a native speaker; zero/one singular plurals (CLDR); Gujarati craft-fonts faces join the UI fonts; strings added on main since branching translated (4,286 rows) | | 2026-11-11 | minor | Gujarati (`gu`): 4,235-row machine-assisted interface catalog, one/other plurals, desktop Gujarati font fallback and a glyph-coverage filter; status and error messages not yet translated; native review pending |