Struct loon_embed::Dictionary [−][src]
pub struct Dictionary { /* fields omitted */ }Expand description
Container for translation messages
Implementations
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::prelude::*;
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"))));Shortcut for translate.
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 dict = Dictionary::default();
let _ = dict.t("custom.greeting", Opts::default().var("name", "Jacob"));
let _ = dict.t(&["custom", "greeting"], Var("name", "Jacob"));
let _ = dict.t("greeting", None);
let _ = dict.t("greeting", (Locale("de"), (DefaultKey("missing.message"))));