Macro json_gettext::get_text [−][src]
macro_rules! get_text { ($ctx : ident, $text : expr) => { ... }; ($ctx : ident, $key : expr, $text : expr) => { ... }; ($ctx : ident, $key : expr, $text : expr, $($text_array : expr), +) => { ... }; }
Expand description
Used for getting single or multiple text from context.
ⓘ
#[macro_use] extern crate json_gettext; let ctx = static_json_gettext_build!( "en_US", "en_US", "langs/en_US.json", "zh_TW", "langs/zh_TW.json" ) .unwrap(); assert_eq!("Hello, world!", get_text!(ctx, "hello").unwrap()); assert_eq!("哈囉,世界!", get_text!(ctx, "zh_TW", "hello").unwrap());