diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index 9f6518cd..952097cc 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -2595,6 +2595,25 @@ impl Context { self.options_mut(|opt| opt.theme_preference = theme_preference.into()); } + /// The language of the user interface, as a BCP 47 tag. + /// + /// See [`Options::language`]. + pub fn language(&self) -> Option { + self.options(|opt| opt.language.clone()) + } + + /// Set the language of the user interface, as a BCP 47 tag (`"ar"`, `"pt-BR"`). + /// + /// See [`Options::language`]. + /// + /// ``` + /// # let ctx = egui::Context::default(); + /// ctx.set_language(Some("ar".to_owned())); + /// ``` + pub fn set_language(&self, language: Option) { + self.options_mut(|opt| opt.language = language); + } + /// The currently active [`Style`] used by all subsequent popups, menus, etc. pub fn global_style(&self) -> Arc