pub struct WebLanguageRequester<'a> { /* private fields */ }
Expand description

A LanguageRequester for the web-sys web platform.

⚠️ This API requires the following crate features to be activated: web-sys-requester.

Implementations§

source§

impl WebLanguageRequester<'_>

source

pub fn new() -> Self

Create a new WebLanguageRequester.

source

pub fn requested_languages() -> Vec<LanguageIdentifier>

The languages currently being requested by the browser context.

Trait Implementations§

source§

impl<'a> Debug for WebLanguageRequester<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for WebLanguageRequester<'_>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'a> LanguageRequester<'a> for WebLanguageRequester<'a>

source§

fn requested_languages(&self) -> Vec<LanguageIdentifier>

The currently requested languages.
source§

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 more
source§

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 more
source§

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 set_language_override( &mut self, language_override: Option<LanguageIdentifier> ) -> Result<(), I18nEmbedError>

Override the languages fed to the Localizer listeners during a #poll(). Set this as None to disable the override.
source§

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>

The languages currently loaded, keyed by the LanguageLoader::domain().

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.