zng::l10n

Macro lang

source
macro_rules! lang {
    ($($tt:tt)+) => { ... };
}
Expand description

Compile-time validated Lang value.

The language is parsed during compile and any errors are emitted as compile time errors.

§Syntax

The input can be a single a single string literal with - separators, or a single ident with _ as the separators.

§Examples

let en_us = lang!(en_US);
let en = lang!(en);

assert!(en.matches(&en_us, true, false));
assert_eq!(en_us, lang!("en-US"));