pub enum I18nValue {
String(String),
I64(i64),
F64(f64),
Bool(bool),
}Expand description
A variable passed to translate for interpolation.
The variants map 1:1 onto the types every major i18n library understands without loss:
String— the common case, arbitrary text.I64— counts, integer ids. Drives plural selection in both Fluent and ICU MessageFormat.F64— ratios, currency amounts. Backends that format numbers (ICU) use this as the input; simpler backends stringify.Bool— binary selectors. Fluent uses booleans to drive{ $isFormal -> [true] ... *[false] ... }patterns.
Dates are deliberately omitted: a date in a translation is almost
always a pre-formatted string (which goes through String) or a
Unix timestamp (which goes through I64). Exposing a dedicated
Date variant would pull in chrono or time as a crate dependency,
which this crate does not take.
Variants§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for I18nValue
impl<'de> Deserialize<'de> for I18nValue
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for I18nValue
Auto Trait Implementations§
impl Freeze for I18nValue
impl RefUnwindSafe for I18nValue
impl Send for I18nValue
impl Sync for I18nValue
impl Unpin for I18nValue
impl UnsafeUnpin for I18nValue
impl UnwindSafe for I18nValue
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