diff --git a/locales/en-US/main.ftl b/locales/en-US/main.ftl index 9ee0bc4..334e84a 100644 --- a/locales/en-US/main.ftl +++ b/locales/en-US/main.ftl @@ -53,6 +53,9 @@ tr-menu-inspect = Inspect tr-menu-inspect-compare-detours = Compare Detours tr-menu-inspect-measure-length = Measure Length +tr-menu-properties = Properties +tr-menu-properties-set-language = Set Language + tr-dialog-error-messages = Error Messages tr-dialog-error-messages-reset = Reset Messages tr-dialog-error-messages-discard = Discard diff --git a/src/bin/topola-egui/app.rs b/src/bin/topola-egui/app.rs index 9739199..a782653 100644 --- a/src/bin/topola-egui/app.rs +++ b/src/bin/topola-egui/app.rs @@ -129,7 +129,7 @@ impl eframe::App for App { fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { self.menu_bar.update( ctx, - &self.translator, + &mut self.translator, self.content_channel.0.clone(), &mut self.viewport, self.maybe_workspace.as_mut(), diff --git a/src/bin/topola-egui/menu_bar.rs b/src/bin/topola-egui/menu_bar.rs index 8ee1120..0f24c16 100644 --- a/src/bin/topola-egui/menu_bar.rs +++ b/src/bin/topola-egui/menu_bar.rs @@ -56,7 +56,7 @@ impl MenuBar { pub fn update( &mut self, ctx: &egui::Context, - tr: &Translator, + tr: &mut Translator, content_sender: Sender>, viewport: &mut Viewport, maybe_workspace: Option<&mut Workspace>, @@ -165,6 +165,19 @@ impl MenuBar { }); }); + ui.menu_button(tr.text("tr-menu-properties"), |ui| { + ui.menu_button(tr.text("tr-menu-properties-set-language"), |ui| { + for langid in Translator::locales() { + ui.radio_value( + tr.langid_mut(), + langid.clone(), + langid.language.as_str(), + ); + //ui.add(egui::RadioButton::new(true, locale.language.as_str())); + } + }); + }); + ui.menu_button(tr.text("tr-menu-help"), |ui| { actions.help.online_documentation.hyperlink( ctx, diff --git a/src/bin/topola-egui/translator.rs b/src/bin/topola-egui/translator.rs index 244b985..1bca0af 100644 --- a/src/bin/topola-egui/translator.rs +++ b/src/bin/topola-egui/translator.rs @@ -22,4 +22,12 @@ impl Translator { pub fn text(&self, fluent_id: &str) -> String { LOCALES.lookup(&self.langid, fluent_id) } + + pub fn langid_mut(&mut self) -> &mut LanguageIdentifier { + &mut self.langid + } + + pub fn locales() -> Box + 'static> { + LOCALES.locales() + } }