pub struct TranslationFile { /* private fields */ }Expand description
A collection of localization messages for a single locale.
See https://projectfluent.org for a description of the syntax of Fluent files.
Implementations§
Source§impl TranslationFile
impl TranslationFile
Sourcepub fn from_str(
locales: Vec<LanguageIdentifier>,
text: &str,
) -> Result<Self, Error>
pub fn from_str( locales: Vec<LanguageIdentifier>, text: &str, ) -> Result<Self, Error>
Loads translations from a string. The first element in locales should be the language this file represents, and will be used to
determine the correct plural rules for this file. You can optionally provide extra languages in the list; they will be used as
fallback date and time formatters if a formatter for the primary language is unavailable.
Sourcepub fn from_file(
locales: Vec<LanguageIdentifier>,
path: impl AsRef<Path>,
) -> Result<TranslationFile, Error>
pub fn from_file( locales: Vec<LanguageIdentifier>, path: impl AsRef<Path>, ) -> Result<TranslationFile, Error>
Loads translations from a file. The first element in locales should be the language this file represents, and will be used to
determine the correct plural rules for this file. You can optionally provide extra languages in the list; they will be used as
fallback date and time formatters if a formatter for the primary language is unavailable.