mirror of https://codeberg.org/topola/topola.git
feat(egui): add radio buttons to choose language
This commit is contained in:
parent
90afd70f2a
commit
4b66e585c5
|
|
@ -53,6 +53,9 @@ tr-menu-inspect = Inspect
|
||||||
tr-menu-inspect-compare-detours = Compare Detours
|
tr-menu-inspect-compare-detours = Compare Detours
|
||||||
tr-menu-inspect-measure-length = Measure Length
|
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 = Error Messages
|
||||||
tr-dialog-error-messages-reset = Reset Messages
|
tr-dialog-error-messages-reset = Reset Messages
|
||||||
tr-dialog-error-messages-discard = Discard
|
tr-dialog-error-messages-discard = Discard
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ impl eframe::App for App {
|
||||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||||
self.menu_bar.update(
|
self.menu_bar.update(
|
||||||
ctx,
|
ctx,
|
||||||
&self.translator,
|
&mut self.translator,
|
||||||
self.content_channel.0.clone(),
|
self.content_channel.0.clone(),
|
||||||
&mut self.viewport,
|
&mut self.viewport,
|
||||||
self.maybe_workspace.as_mut(),
|
self.maybe_workspace.as_mut(),
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ impl MenuBar {
|
||||||
pub fn update(
|
pub fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &egui::Context,
|
ctx: &egui::Context,
|
||||||
tr: &Translator,
|
tr: &mut Translator,
|
||||||
content_sender: Sender<Result<SpecctraDesign, SpecctraLoadingError>>,
|
content_sender: Sender<Result<SpecctraDesign, SpecctraLoadingError>>,
|
||||||
viewport: &mut Viewport,
|
viewport: &mut Viewport,
|
||||||
maybe_workspace: Option<&mut Workspace>,
|
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| {
|
ui.menu_button(tr.text("tr-menu-help"), |ui| {
|
||||||
actions.help.online_documentation.hyperlink(
|
actions.help.online_documentation.hyperlink(
|
||||||
ctx,
|
ctx,
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,12 @@ impl Translator {
|
||||||
pub fn text(&self, fluent_id: &str) -> String {
|
pub fn text(&self, fluent_id: &str) -> String {
|
||||||
LOCALES.lookup(&self.langid, fluent_id)
|
LOCALES.lookup(&self.langid, fluent_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn langid_mut(&mut self) -> &mut LanguageIdentifier {
|
||||||
|
&mut self.langid
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn locales() -> Box<dyn Iterator<Item = &'static LanguageIdentifier> + 'static> {
|
||||||
|
LOCALES.locales()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue