DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
macOS: the menu bar follows the interface language at once
con3codecc12ea576ff8
diff --git a/apps/designcraft/src/native_menu.rs b/apps/designcraft/src/native_menu.rsindex 8bf75b159..f235d05fe 100644--- a/apps/designcraft/src/native_menu.rs+++ b/apps/designcraft/src/native_menu.rs@@ -20,6 +20,8 @@ pub struct NativeMenu {_menu: Menu,items: HashMap<String, (String, Value, Handle)>,last_refresh: f64,+ /// The interface language the titles are in: the menu is rebuilt when it changes.+ language: String,}/// Accelerator for "Cmd+Shift+]" (modifier-less shortcuts stay in the app so typing works).@@ -69,7 +71,7 @@ impl NativeMenu {(p.is_null() && accel(sc).is_some()).then(|| id.clone())}).collect();- Self { _menu: menu, items, last_refresh: 0.0 }+ Self { _menu: menu, items, last_refresh: 0.0, language: app.ui.language.clone() }}pub fn poll(&mut self, app: &mut DesignApp, ctx: &egui::Context) {@@ -78,6 +80,11 @@ impl NativeMenu {menus::activate_native(app, ctx, &cmd.clone(), ¶ms.clone());}}+ // Edit › Interface Language: the system menu bar follows at once, like the panels (the+ // new menu replaces the old one as the application's menu before that one is dropped).+ if app.ui.language != self.language {+ *self = Self::install(app);+ }let now = designcraft_ui_egui::now_ms();if now - self.last_refresh < 250.0 {return;