pub trait Loader {
// Required methods
fn lookup_complete(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>,
) -> String;
fn try_lookup_complete(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>,
) -> Option<String>;
fn locales(&self) -> Box<dyn Iterator<Item = &LanguageIdentifier> + '_>;
// Provided methods
fn lookup(&self, lang: &LanguageIdentifier, text_id: &str) -> String { ... }
fn lookup_with_args(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: &HashMap<Cow<'static, str>, FluentValue<'_>>,
) -> String { ... }
fn try_lookup(
&self,
lang: &LanguageIdentifier,
text_id: &str,
) -> Option<String> { ... }
fn try_lookup_with_args(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: &HashMap<Cow<'static, str>, FluentValue<'_>>,
) -> Option<String> { ... }
}
Expand description
A loader capable of looking up Fluent keys given a language.
Required Methods§
Sourcefn lookup_complete(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>,
) -> String
fn lookup_complete( &self, lang: &LanguageIdentifier, text_id: &str, args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>, ) -> String
Look up text_id
for lang
in Fluent, using any args
if provided.
Sourcefn try_lookup_complete(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>,
) -> Option<String>
fn try_lookup_complete( &self, lang: &LanguageIdentifier, text_id: &str, args: Option<&HashMap<Cow<'static, str>, FluentValue<'_>>>, ) -> Option<String>
Look up text_id
for lang
in Fluent, using any args
if provided.
Sourcefn locales(&self) -> Box<dyn Iterator<Item = &LanguageIdentifier> + '_>
fn locales(&self) -> Box<dyn Iterator<Item = &LanguageIdentifier> + '_>
Returns an Iterator over the locales that are present.
Provided Methods§
Sourcefn lookup(&self, lang: &LanguageIdentifier, text_id: &str) -> String
fn lookup(&self, lang: &LanguageIdentifier, text_id: &str) -> String
Look up text_id
for lang
in Fluent.
Sourcefn lookup_with_args(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: &HashMap<Cow<'static, str>, FluentValue<'_>>,
) -> String
fn lookup_with_args( &self, lang: &LanguageIdentifier, text_id: &str, args: &HashMap<Cow<'static, str>, FluentValue<'_>>, ) -> String
Look up text_id
for lang
with args
in Fluent.
Sourcefn try_lookup(&self, lang: &LanguageIdentifier, text_id: &str) -> Option<String>
fn try_lookup(&self, lang: &LanguageIdentifier, text_id: &str) -> Option<String>
Look up text_id
for lang
in Fluent.
Sourcefn try_lookup_with_args(
&self,
lang: &LanguageIdentifier,
text_id: &str,
args: &HashMap<Cow<'static, str>, FluentValue<'_>>,
) -> Option<String>
fn try_lookup_with_args( &self, lang: &LanguageIdentifier, text_id: &str, args: &HashMap<Cow<'static, str>, FluentValue<'_>>, ) -> Option<String>
Look up text_id
for lang
with args
in Fluent.