pub struct Translation {
pub key: String,
pub params: BTreeMap<String, Value>,
}Expand description
A translation key and the params its message interpolates.
Attached to a JsonApiError with
translate, and serialized under the
error object’s meta.i18n.
The key is yours: this crate never invents one, and never rewrites one. Keep it stable across wording changes — that is the whole point of it — and namespace it however your catalog is organized.
Fields§
§key: StringThe catalog key, e.g. todo.name.too_long.
params: BTreeMap<String, Value>The values the message interpolates, e.g. { "max": 80 }.
Omitted from the response when empty, so a message with no placeholders does not carry an empty object.
Implementations§
Trait Implementations§
Source§impl Clone for Translation
impl Clone for Translation
Source§impl Debug for Translation
impl Debug for Translation
Source§impl<'de> Deserialize<'de> for Translation
impl<'de> Deserialize<'de> for Translation
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
Source§impl PartialEq for Translation
impl PartialEq for Translation
Source§impl Serialize for Translation
impl Serialize for Translation
impl StructuralPartialEq for Translation
Auto Trait Implementations§
impl Freeze for Translation
impl RefUnwindSafe for Translation
impl Send for Translation
impl Sync for Translation
impl Unpin for Translation
impl UnsafeUnpin for Translation
impl UnwindSafe for Translation
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