[][src]Struct i18n_embed::gettext::GettextLanguageLoader

pub struct GettextLanguageLoader { /* fields omitted */ }

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]

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.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.