Struct druid::LocalizedString
source · pub struct LocalizedString<T> { /* private fields */ }
Expand description
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§
source§impl<T> LocalizedString<T>
impl<T> LocalizedString<T>
sourcepub fn with_placeholder(self, placeholder: impl Into<ArcStr>) -> Self
pub fn with_placeholder(self, placeholder: impl Into<ArcStr>) -> Self
Add a placeholder value. This will be used if localization fails.
This is intended for use during prototyping.
sourcepub fn localized_str(&self) -> ArcStr
pub fn localized_str(&self) -> ArcStr
Return the localized value for this string, or the placeholder, if the localization is missing, or the key if there is no placeholder.
Trait Implementations§
source§impl<T: Clone> Clone for LocalizedString<T>
impl<T: Clone> Clone for LocalizedString<T>
source§fn clone(&self) -> LocalizedString<T>
fn clone(&self) -> LocalizedString<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for LocalizedString<T>
impl<T: Debug> Debug for LocalizedString<T>
source§impl<T> From<LocalizedString<T>> for LabelText<T>
impl<T> From<LocalizedString<T>> for LabelText<T>
source§fn from(src: LocalizedString<T>) -> LabelText<T>
fn from(src: LocalizedString<T>) -> LabelText<T>
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> !RefUnwindSafe for LocalizedString<T>
impl<T> !Send for LocalizedString<T>
impl<T> !Sync for LocalizedString<T>
impl<T> Unpin for LocalizedString<T>
impl<T> !UnwindSafe for LocalizedString<T>
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.