Struct i18n_embed::DefaultLocalizer
source · pub struct DefaultLocalizer<'a> {
pub language_loader: &'a dyn LanguageLoader,
pub i18n_assets: &'a dyn I18nAssets,
}
Expand description
A simple default implemenation of the Localizer trait.
Fields§
§language_loader: &'a dyn LanguageLoader
The LanguageLoader used by this localizer.
i18n_assets: &'a dyn I18nAssets
The source of assets used by this localizer.
Implementations§
source§impl<'a> DefaultLocalizer<'a>
impl<'a> DefaultLocalizer<'a>
sourcepub fn new(
language_loader: &'a dyn LanguageLoader,
i18n_assets: &'a dyn I18nAssets
) -> DefaultLocalizer<'a>
pub fn new( language_loader: &'a dyn LanguageLoader, i18n_assets: &'a dyn I18nAssets ) -> DefaultLocalizer<'a>
Create a new DefaultLocalizer.
Trait Implementations§
source§impl Debug for DefaultLocalizer<'_>
impl Debug for DefaultLocalizer<'_>
source§impl<'a> Localizer for DefaultLocalizer<'a>
impl<'a> Localizer for DefaultLocalizer<'a>
source§fn language_loader(&self) -> &dyn LanguageLoader
fn language_loader(&self) -> &dyn LanguageLoader
The LanguageLoader used by this localizer.
source§fn i18n_assets(&self) -> &dyn I18nAssets
fn i18n_assets(&self) -> &dyn I18nAssets
The source of localization assets used by this localizer
source§fn available_languages(&self) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
fn available_languages(&self) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
The available languages that can be selected by this localizer.
source§fn select(
&self,
requested_languages: &[LanguageIdentifier]
) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
fn select( &self, requested_languages: &[LanguageIdentifier] ) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
Automatically the language currently requested by the system
by the the LanguageRequester), and load
it using the provided LanguageLoader.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for DefaultLocalizer<'a>
impl<'a> !Send for DefaultLocalizer<'a>
impl<'a> !Sync for DefaultLocalizer<'a>
impl<'a> Unpin for DefaultLocalizer<'a>
impl<'a> !UnwindSafe for DefaultLocalizer<'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