pub struct Localizer { /* private fields */ }Expand description
Message table used in the execution process.
Implementations§
Source§impl Localizer
impl Localizer
Sourcepub fn from_environment() -> Self
pub fn from_environment() -> Self
Determine the locale from the current process environment.
Sourcepub fn language_identifier(&self) -> &LanguageIdentifier
pub fn language_identifier(&self) -> &LanguageIdentifier
Returns Fluent’s locale identifier chosen from an environment variable.
Sourcepub fn lookup(&self, id: &str) -> Option<String>
pub fn lookup(&self, id: &str) -> Option<String>
Resolve any Fluent message ID.
Resolve dynamic messages that are difficult to enumerate, such as clap’s help, from the
resource bundle. Return None for an unknown ID or invalid pattern so callers can keep
their default wording.
Sourcepub fn format<'a>(
&self,
message: Message,
variables: impl IntoIterator<Item = (&'a str, &'a str)>,
) -> String
pub fn format<'a>( &self, message: Message, variables: impl IntoIterator<Item = (&'a str, &'a str)>, ) -> String
Resolve messages by giving them Fluent variables.
If a built-in FTL resource is missing or cannot be formatted, return the message identifier so a resource problem cannot make the CLI or TUI undisplayable.
Auto Trait Implementations§
impl !Freeze for Localizer
impl !RefUnwindSafe for Localizer
impl !UnwindSafe for Localizer
impl Send for Localizer
impl Sync for Localizer
impl Unpin for Localizer
impl UnsafeUnpin for Localizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more