pub struct Translator(/* private fields */);Expand description
A thread-owned formatter with no cross-thread locks during formatting.
Construct one from a shared Catalog on each thread that needs translations.
Implementations§
Source§impl Translator
impl Translator
Sourcepub fn formatting_locale(&self) -> &Locale
pub fn formatting_locale(&self) -> &Locale
The requested regional locale that selected this catalog language.
Data formatting retains region preferences such as en-GB even when UI
messages come from the more general en catalog.
Sourcepub fn formatters(&self) -> Result<Rc<LocaleFormatters>, FormatError>
pub fn formatters(&self) -> Result<Rc<LocaleFormatters>, FormatError>
Reuses locale-aware data formatters across every consumer of this translator.
Sourcepub fn locale(&self) -> &Locale
pub fn locale(&self) -> &Locale
The first selected catalog language and the requested preview settings. Layout direction follows this effective language, including on fallback.
Sourcepub fn with_fallback(&self, library: &Catalog) -> Translator
pub fn with_fallback(&self, library: &Catalog) -> Translator
Adds library translations while retaining the original language preferences.
Trait Implementations§
Source§impl Clone for Translator
impl Clone for Translator
Source§fn clone(&self) -> Translator
fn clone(&self) -> Translator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for Translator
impl !Send for Translator
impl !Sync for Translator
impl !UnwindSafe for Translator
impl Freeze for Translator
impl Unpin for Translator
impl UnsafeUnpin for Translator
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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