pub enum LanguagePreference {
System,
Selected(Language),
}Expand description
A saved application language choice, independent of the current system locale.
Variants§
System
Follow the host’s ordered language preferences.
Selected(Language)
Use an explicitly selected application language.
Implementations§
Source§impl LanguagePreference
impl LanguagePreference
Sourcepub fn from_setting(
value: Option<&str>,
catalog: &Catalog,
) -> LanguagePreference
pub fn from_setting( value: Option<&str>, catalog: &Catalog, ) -> LanguagePreference
Reads a saved tag. Missing or unsupported tags follow the system.
Sourcepub fn translator(&self, catalog: &Catalog, system: &[Locale]) -> Translator
pub fn translator(&self, catalog: &Catalog, system: &[Locale]) -> Translator
Selects a formatter for this preference and the current host languages.
Trait Implementations§
Source§impl Clone for LanguagePreference
impl Clone for LanguagePreference
Source§fn clone(&self) -> LanguagePreference
fn clone(&self) -> LanguagePreference
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 moreSource§impl Debug for LanguagePreference
impl Debug for LanguagePreference
Source§impl Default for LanguagePreference
impl Default for LanguagePreference
Source§fn default() -> LanguagePreference
fn default() -> LanguagePreference
Returns the “default value” for a type. Read more
impl Eq for LanguagePreference
Source§impl PartialEq for LanguagePreference
impl PartialEq for LanguagePreference
impl StructuralPartialEq for LanguagePreference
Auto Trait Implementations§
impl Freeze for LanguagePreference
impl RefUnwindSafe for LanguagePreference
impl Send for LanguagePreference
impl Sync for LanguagePreference
impl Unpin for LanguagePreference
impl UnsafeUnpin for LanguagePreference
impl UnwindSafe for LanguagePreference
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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