[−][src]Function loon::translate
pub fn translate<'a, K: Into<Key<'a>>, I: Into<Opts<'a>>>(
key: K,
opts: I
) -> Result<String>
Get the translated message, using the global configuration.
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::prelude::*; let _ = translate("custom.greeting", Opts::default().var("name", "Jacob")); let _ = translate(&["custom", "greeting"], Var("name", "Jacob")); let _ = translate("greeting", None); let _ = translate("greeting", (Locale("de"), (DefaultKey("missing.message"))));