[][src]Trait i18n_embed::LanguageLoader

pub trait LanguageLoader {
    fn src_locale(&self) -> LanguageIdentifier;
fn domain(&self) -> &'static str;
fn load_language_file(
        &self,
        language_id: LanguageIdentifier,
        file: Cow<[u8]>
    );
fn load_src_locale(&self);
fn language_file_name(&self) -> String;
fn current_language(&self) -> LanguageIdentifier; fn load_language(
        &self,
        language_id: &LanguageIdentifier,
        i18n_embed: &dyn I18nEmbedDyn
    ) -> Result<(), I18nEmbedError> { ... } }

A trait used by I18nEmbed to load a language file for a specific rust module using a specific localization system. The trait is designed such that the loader could be swapped during runtime, or contain state if required.

Required methods

fn src_locale(&self) -> LanguageIdentifier

The locale used in the source code for the module this loader is responsible for.

fn domain(&self) -> &'static str

The domain for the translation that this loader is associated with.

fn load_language_file(&self, language_id: LanguageIdentifier, file: Cow<[u8]>)

Load the language file which is associated with the specified language_id and set the current language, which can be retrieved via current_language().

fn load_src_locale(&self)

Load the language associated with src_locale().

fn language_file_name(&self) -> String

The language file name to use for this loader.

fn current_language(&self) -> LanguageIdentifier

Get the language which is currently loaded for this loader.

Loading content...

Provided methods

fn load_language(
    &self,
    language_id: &LanguageIdentifier,
    i18n_embed: &dyn I18nEmbedDyn
) -> Result<(), I18nEmbedError>

Load the language corresponding the specified language_id.

Loading content...

Implementors

Loading content...