macro_rules! t {
($key:expr $(,)?) => { ... };
($key:expr, $($name:ident = $value:expr),+ $(,)?) => { ... };
}Expand description
Translates a key with the active translator.
use std::sync::Arc;
use qframe::{i18n, t};
let mut catalog = i18n::I18n::builtin();
catalog.add_source(
"app-tr.toml",
"[meta]\nname = \"Türkçe\"\ncode = \"tr\"\n[files]\ncount = { one = \"{n} dosya\", other = \"{n} dosya\" }\n",
);
catalog.set_active("tr");
let label = i18n::scope(Arc::new(catalog), || t!("files.count", n = 3));
assert_eq!(label, "3 dosya");