Struct i18n_embed::DesktopLanguageRequester
source · pub struct DesktopLanguageRequester<'a> { /* private fields */ }
Expand description
A LanguageRequester for the desktop platform, supporting windows, linux and mac. It uses locale_config to select the language based on the system selected language.
⚠️ This API requires the following crate features to be activated: desktop-requester
.
Implementations§
source§impl DesktopLanguageRequester<'_>
impl DesktopLanguageRequester<'_>
sourcepub fn requested_languages() -> Vec<LanguageIdentifier>
pub fn requested_languages() -> Vec<LanguageIdentifier>
The languages being requested by the operating system/environment according to the locale_config crate’s implementation.
Trait Implementations§
source§impl<'a> Debug for DesktopLanguageRequester<'a>
impl<'a> Debug for DesktopLanguageRequester<'a>
source§impl Default for DesktopLanguageRequester<'_>
impl Default for DesktopLanguageRequester<'_>
source§impl<'a> LanguageRequester<'a> for DesktopLanguageRequester<'a>
impl<'a> LanguageRequester<'a> for DesktopLanguageRequester<'a>
source§fn requested_languages(&self) -> Vec<LanguageIdentifier>
fn requested_languages(&self) -> Vec<LanguageIdentifier>
The currently requested languages.
source§fn add_listener(&mut self, listener: Weak<dyn Localizer>)
fn add_listener(&mut self, listener: Weak<dyn Localizer>)
Add a listener to this
LanguageRequester
. When the system
reports that the currently requested languages has changed,
each listener will have its
Localizer#select() method called. Weak
is used so that when the Arc that it references
is dropped, the listener will also be removed next time this
requester is polled/updates. Read moresource§fn add_listener_ref(&mut self, listener: &'a dyn Localizer)
fn add_listener_ref(&mut self, listener: &'a dyn Localizer)
Add a listener to this
LanguageRequester
. When the system
reports that the currently requested languages has changed,
each listener will have its
Localizer#select() method called. As
opposed to LanguageRequester::add_listener(), this listener
will not be removed. Read moresource§fn set_language_override(
&mut self,
language_override: Option<LanguageIdentifier>
) -> Result<(), I18nEmbedError>
fn set_language_override( &mut self, language_override: Option<LanguageIdentifier> ) -> Result<(), I18nEmbedError>
source§fn poll(&mut self) -> Result<(), I18nEmbedError>
fn poll(&mut self) -> Result<(), I18nEmbedError>
Poll the system’s currently selected language, and call
Localizer#select() on each of the
listeners. Read more
source§fn available_languages(&self) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
fn available_languages(&self) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
The languages reported to be available in the
listener Localizers.
source§fn current_languages(&self) -> HashMap<String, LanguageIdentifier>
fn current_languages(&self) -> HashMap<String, LanguageIdentifier>
The languages currently loaded, keyed by the
LanguageLoader::domain().
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for DesktopLanguageRequester<'a>
impl<'a> !Send for DesktopLanguageRequester<'a>
impl<'a> !Sync for DesktopLanguageRequester<'a>
impl<'a> Unpin for DesktopLanguageRequester<'a>
impl<'a> !UnwindSafe for DesktopLanguageRequester<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more