Struct i18n_embed::gettext::GettextLanguageLoader
source · [−]pub struct GettextLanguageLoader { /* private fields */ }Expand description
LanguageLoader implementation for the gettext localization
system.
⚠️ This API requires the following crate features to be activated: gettext-system.
Implementations
Trait Implementations
sourceimpl Debug for GettextLanguageLoader
impl Debug for GettextLanguageLoader
sourceimpl LanguageLoader for GettextLanguageLoader
impl LanguageLoader for GettextLanguageLoader
sourcefn fallback_language(&self) -> &LanguageIdentifier
fn fallback_language(&self) -> &LanguageIdentifier
The fallback language for the module this loader is responsible for.
sourcefn domain(&self) -> &'static str
fn domain(&self) -> &'static str
The domain for the translation that this loader is associated with.
sourcefn language_file_name(&self) -> String
fn language_file_name(&self) -> String
The language file name to use for this loader’s domain.
sourcefn current_language(&self) -> LanguageIdentifier
fn current_language(&self) -> LanguageIdentifier
Get the language which is currently loaded for this loader.
sourcefn load_languages(
&self,
i18n_assets: &dyn I18nAssets,
language_ids: &[&LanguageIdentifier]
) -> Result<(), I18nEmbedError>
fn load_languages(
&self,
i18n_assets: &dyn I18nAssets,
language_ids: &[&LanguageIdentifier]
) -> Result<(), I18nEmbedError>
Load the languages language_ids using the resources packaged
in the i18n_assets in order of fallback preference. This
also sets the LanguageLoader::current_language() to the
first in the language_ids slice. You can use
select() to determine which fallbacks are
actually available for an arbitrary slice of preferences.
Note: Gettext doesn’t support loading multiple languages as multiple fallbacks. We only load the first of the requested languages, and the fallback is the src language.
sourcefn language_file<'a>(
&self,
language_id: &LanguageIdentifier,
i18n_assets: &'a dyn I18nAssets
) -> (String, Option<Cow<'a, [u8]>>)
fn language_file<'a>(
&self,
language_id: &LanguageIdentifier,
i18n_assets: &'a dyn I18nAssets
) -> (String, Option<Cow<'a, [u8]>>)
The computed path to the language file, and Cow of the file
itself if it exists. Read more
sourcefn available_languages(
&self,
i18n_assets: &dyn I18nAssets
) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
fn available_languages(
&self,
i18n_assets: &dyn I18nAssets
) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
Calculate the languages which are available to be loaded.
sourcefn load_fallback_language(
&self,
i18n_assets: &dyn I18nAssets
) -> Result<(), I18nEmbedError>
fn load_fallback_language(
&self,
i18n_assets: &dyn I18nAssets
) -> Result<(), I18nEmbedError>
Load the LanguageLoader::fallback_language().
Auto Trait Implementations
impl !RefUnwindSafe for GettextLanguageLoader
impl Send for GettextLanguageLoader
impl Sync for GettextLanguageLoader
impl Unpin for GettextLanguageLoader
impl UnwindSafe for GettextLanguageLoader
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more