pub struct LocaleString {
pub default: String,
pub variants: HashMap<String, String>,
}
Expand description
A string that can have different values based on the system locale. Used for internationalization of desktop entries.
Fields§
§default: String
The default value when no locale-specific variant is available
variants: HashMap<String, String>
Map of locale codes to translated strings
Implementations§
Source§impl LocaleString
impl LocaleString
Sourcepub fn get_variant(&self, locale: &str) -> &str
pub fn get_variant(&self, locale: &str) -> &str
Get the variant of the locale string, returns the default value if not found
Trait Implementations§
Source§impl Clone for LocaleString
impl Clone for LocaleString
Source§fn clone(&self) -> LocaleString
fn clone(&self) -> LocaleString
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for LocaleString
impl Debug for LocaleString
Source§impl Default for LocaleString
impl Default for LocaleString
Source§fn default() -> LocaleString
fn default() -> LocaleString
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LocaleString
impl RefUnwindSafe for LocaleString
impl Send for LocaleString
impl Sync for LocaleString
impl Unpin for LocaleString
impl UnwindSafe for LocaleString
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