Macro r18::set_locale

source ·
macro_rules! set_locale {
    ($locale:expr) => { ... };
}
Expand description

Sets the current locale.

If the input language tag is invalid or not translated, the translation will be disabled.

Example

r18::set_locale!("zh-CN");   // assume the zh-CN has been translated
assert_eq!(Some("zh-CN"), r18::locale!());
r18::set_locale!("");
assert_eq!(None, r18::locale!());