DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
macOS: a Language submenu in the app menu (#1541)
aiongg2660395db553
diff --git a/ROADMAP.md b/ROADMAP.mdindex 013cc48db..9c4cb465c 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -348,6 +348,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.mNewest first.+- **2026-10-22** · macOS: the app menu has a Language submenu after Settings… with each interface language in its own name and the current one checked, as in the suite's other apps; Preferences › General › Interface Language stays. No readiness percentage change.- **2026-10-22** · macOS menu bar: the menus keep working after the interface language or Show CJK Features changes (a rebuilt menu bar lost every click, Quit included), and its key equivalents are the shortcuts in effect, so a shortcut moved in the Keyboard Shortcuts editor leaves its old menu item. No readiness percentage change.- **2026-10-22** · Paragraph rules: Rule Above's offset is measured from the first line's baseline to the rule's bottom edge, as in InDesign. Rules sat one ascent too high and crossed the previous paragraph's text (reported from an imported INDD document). No readiness percentage change.- **2026-10-16** · Type › Reload Fonts (`font.reload`): fonts installed, edited or removed while DesignCraft runs are read again without a restart, and the open documents recompose with them (#328, #547). An edited font file is noticed by its length and modification time; bundled, added and document fonts stay as they are. InDesign does this by itself, so noticing changes automatically is still open (gap 6). No readiness percentage change.diff --git a/apps/designcraft/src/native_menu.rs b/apps/designcraft/src/native_menu.rsindex e444641bf..1ac9437d1 100644--- a/apps/designcraft/src/native_menu.rs+++ b/apps/designcraft/src/native_menu.rs@@ -91,6 +91,18 @@ impl NativeMenu {items.insert(id.into(), (command.into(), Value::Null, Handle::Plain(item)));appended}+ AppMenuItem::Language => {+ let sub = Submenu::new(menu_title(app, "Language"), true);+ for (code, name) in designcraft_ui_egui::i18n::LANGUAGES {+ let id = format!("dc-language-{}", if code.is_empty() { "en" } else { code });+ let params = serde_json::json!({ "lang": code });+ let checked = menus::checked(app, "app.language", ¶ms).unwrap_or(false);+ let item = CheckMenuItem::with_id(id.clone(), menus::native_label(name), true, checked, None);+ let _ = sub.append(&item);+ items.insert(id, ("app.language".into(), params, Handle::Check(item)));+ }+ app_menu.append(&sub)+ }AppMenuItem::Sep => app_menu.append(&PredefinedMenuItem::separator()),AppMenuItem::Services => app_menu.append(&PredefinedMenuItem::services(None)),AppMenuItem::Hide => app_menu.append(&PredefinedMenuItem::hide(None)),diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rsindex efe089ef9..c2abdb9a9 100644--- a/crates/ui-egui/src/i18n.rs+++ b/crates/ui-egui/src/i18n.rs@@ -3155,7 +3155,7 @@ const TABLE: &[(&str, [&str; 5])] = &[("Graphic…", ["Graphic…", "Graphique…", "Graphic…", "Graphic…", "图形…"]),("Home", ["Home", "Accueil", "Home", "Home", "主页"]),("Join:", ["Join:", "Sommet :", "Join:", "Join:", "连接:"]),- ("Language", ["Language", "Langue", "Language", "Language", "语言"]),+ ("Language", ["Sprache", "Langue", "Idioma", "言語", "语言"]),("Last Spread", ["Last Spread", "Dernière planche", "Last Spread", "Last Spread", "最后一个跨页"]),("Load DTD…", ["Load DTD…", "Charger la DTD…", "Load DTD…", "Load DTD…", "载入 DTD…"]),("Location:", ["Location:", "Emplacement :", "Location:", "Location:", "位置:"]),diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex 5677c329e..c455b718d 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -2286,6 +2286,9 @@ pub enum AppMenuItem {command: &'static str,},Sep,+ /// Interface language: a submenu with each UI language in its own name, the current one+ /// checked (`app.language {lang}`).+ Language,Services,Hide,HideOthers,@@ -2298,6 +2301,7 @@ pub const MAC_APP_MENU: &[AppMenuItem] = &[AppMenuItem::Cmd { id: "dc-discord", label: "Join the ArtCraft Discord…", command: "help.discord" },AppMenuItem::Sep,AppMenuItem::Cmd { id: "dc-settings", label: "Settings…", command: "app.preferences" },+ AppMenuItem::Language,AppMenuItem::Sep,AppMenuItem::Services,AppMenuItem::Sep,@@ -5566,7 +5570,12 @@ mod tests {let (Some(about), Some(settings)) = (pos("help.about"), pos("app.preferences")) else { panic!("About and Settings are in the app menu") };assert!(about < settings);assert_eq!(MAC_APP_MENU.get(settings - 1), Some(&AppMenuItem::Sep));- assert_eq!(MAC_APP_MENU.get(settings + 1), Some(&AppMenuItem::Sep));+ // Language follows Settings, as in the suite's other apps, titled in the interface language.+ assert_eq!(MAC_APP_MENU.get(settings + 1), Some(&AppMenuItem::Language));+ assert_eq!(MAC_APP_MENU.get(settings + 2), Some(&AppMenuItem::Sep));+ for (code, _) in crate::i18n::LANGUAGES.iter().filter(|(c, _)| !c.is_empty()) {+ assert_ne!(crate::i18n::tr(code, "Language"), "Language", "{code}");+ }let label = |command: &str| {MAC_APP_MENU.iter().find_map(|m| match m {AppMenuItem::Cmd { label, command: c, .. } if *c == command => Some(*label),