pub struct FluentLanguageLoader { /* private fields */ }
Expand description

LanguageLoader implemenation for the fluent localization system. Also provides methods to access localizations which have been loaded.

⚠️ This API requires the following crate features to be activated: fluent-system.

Implementations

Create a new FluentLanguageLoader, which loads messages for the specified domain, and relies on the specified fallback_language for any messages that do not exist for the current language.

The languages associated with each actual loaded language bundle.

Get a localized message referenced by the message_id.

A non-generic version of FluentLanguageLoader::get_args().

A non-generic version of FluentLanguageLoader::get_args() accepting [FluentArgs] instead of a HashMap.

Get a localized message referenced by the message_id, and formatted with the specified args.

Get a localized message referenced by the message_id.

A non-generic version of FluentLanguageLoader::get_lang_args().

A non-generic version of FluentLanguageLoader::get_lang_args() accepting [FluentArgs] instead of a HashMap.

Get a localized message for the given language identifiers, referenced by the message_id and formatted with the specified args.

Returns true if a message with the specified message_id is available in any of the languages currently loaded (including the fallback language).

Run the closure with the message that matches the specified message_id (if it is available in any of the languages currently loaded, including the fallback language). Returns Some of whatever whatever the closure returns, or None if no messages were found matching the message_id.

Runs the provided closure with an iterator over the messages available for the specified language. There may be duplicate messages when they are duplicated in resources applicable to the language. Returns the result of the closure.

Set whether the underlying Fluent logic should insert Unicode Directionality Isolation Marks around placeables.

See [fluent::bundle::FluentBundleBase::set_use_isolating] for more information.

Note: This function will have no effect if LanguageLoader::load_languages has not been called first.

Default: true.

Apply some configuration to each budle in this loader.

Note: This function will have no effect if LanguageLoader::load_languages has not been called first.

Trait Implementations

Formats the value using the given formatter. Read more

The fallback language for the module this loader is responsible for.

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

The language file name to use for this loader.

Get the language which is currently loaded for this loader.

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.

The computed path to the language file, and Cow of the file itself if it exists. Read more

Calculate the languages which are available to be loaded.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.