[−][src]Struct loon::Dictionary
Container for translation messages
Methods
impl Dictionary
[src]
pub fn translate<'a, K: Into<Key<'a>>, I: Into<Opts<'a>>>(
&self,
key: K,
opts: I
) -> Result<String>
[src]
&self,
key: K,
opts: I
) -> Result<String>
Get the translated message.
key
can be a dot-delimited &str
or a &[&str]
path.
opts
can be an Opts
object, None
, or Var,
Count,
Locale, or
DefaultKey(or up to a
4-tuple` of these items).
Examples:
use loon::*; let dict = Dictionary::default(); let _ = dict.translate("custom.greeting", Opts::default().var("name", "Jacob")); let _ = dict.translate(&["custom", "greeting"], Var("name", "Jacob")); let _ = dict.translate("greeting", None); let _ = dict.translate("greeting", (Locale("de"), (DefaultKey("missing.message"))));
Trait Implementations
impl Debug for Dictionary
[src]
impl Default for Dictionary
[src]
Auto Trait Implementations
impl RefUnwindSafe for Dictionary
impl Send for Dictionary
impl Sync for Dictionary
impl Unpin for Dictionary
impl UnwindSafe for Dictionary
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,
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, 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.
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>,