[−][src]Struct druid::LocalizedString
A string that can be localized based on the current locale.
At its simplest, a LocalizedString
is a key that can be resolved
against a map of localized strings for a given locale.
Implementations
impl<T> LocalizedString<T>
[src]
pub const fn new(key: &'static str) -> Self
[src]
Create a new LocalizedString
with the given key.
pub fn with_placeholder(self, placeholder: impl Into<ArcStr>) -> Self
[src]
Add a placeholder value. This will be used if localization fails.
This is intended for use during prototyping.
pub fn localized_str(&self) -> ArcStr
[src]
Return the localized value for this string, or the placeholder, if the localization is missing, or the key if there is no placeholder.
pub fn with_arg(
self,
key: &'static str,
f: impl Fn(&T, &Env) -> FluentValue<'static> + 'static
) -> Self
[src]
self,
key: &'static str,
f: impl Fn(&T, &Env) -> FluentValue<'static> + 'static
) -> Self
Add a named argument and a corresponding closure. This closure is a function that will return a value for the given key from the current environment and data.
pub fn resolve<'a>(&'a mut self, data: &T, env: &Env) -> bool
[src]
Lazily compute the localized value for this string based on the provided environment and data.
Returns true
if the current value of the string has changed.
Trait Implementations
impl<T: Clone> Clone for LocalizedString<T>
[src]
pub fn clone(&self) -> LocalizedString<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for LocalizedString<T>
[src]
impl<T> From<LocalizedString<T>> for LabelText<T>
[src]
pub fn from(src: LocalizedString<T>) -> LabelText<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for LocalizedString<T>
[src]
impl<T> !Send for LocalizedString<T>
[src]
impl<T> !Sync for LocalizedString<T>
[src]
impl<T> Unpin for LocalizedString<T>
[src]
impl<T> !UnwindSafe for LocalizedString<T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,