[−][src]Struct i18n_embed::gettext::GettextLanguageLoader
LanguageLoader implementation for the gettext
localization
system.
⚠️ This API requires the following crate features to be activated: gettext-system
.
Implementations
impl GettextLanguageLoader
[src]
pub fn new(module: &'static str, fallback_language: LanguageIdentifier) -> Self
[src]
Create a new GettextLanguageLoader
.
Example
use i18n_embed::gettext::GettextLanguageLoader; GettextLanguageLoader::new(module_path!(), "en".parse().unwrap());
Trait Implementations
impl Debug for GettextLanguageLoader
[src]
impl LanguageLoader for GettextLanguageLoader
[src]
fn fallback_language(&self) -> &LanguageIdentifier
[src]
The fallback language for the module this loader is responsible for.
fn domain(&self) -> &'static str
[src]
The domain for the translation that this loader is associated with.
fn language_file_name(&self) -> String
[src]
The language file name to use for this loader's domain.
fn current_language(&self) -> LanguageIdentifier
[src]
Get the language which is currently loaded for this loader.
fn load_languages(
&self,
i18n_assets: &dyn I18nAssets,
language_ids: &[&LanguageIdentifier]
) -> Result<(), I18nEmbedError>
[src]
&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.
fn language_file<'a>(
&self,
language_id: &LanguageIdentifier,
i18n_assets: &'a dyn I18nAssets
) -> (String, Option<Cow<'a, [u8]>>)
[src]
&self,
language_id: &LanguageIdentifier,
i18n_assets: &'a dyn I18nAssets
) -> (String, Option<Cow<'a, [u8]>>)
fn available_languages(
&self,
i18n_assets: &dyn I18nAssets
) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
[src]
&self,
i18n_assets: &dyn I18nAssets
) -> Result<Vec<LanguageIdentifier>, I18nEmbedError>
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,