Macro langid
macro_rules! langid {
($langid:literal) => { ... };
}
A macro allowing for compile-time construction of valid LanguageIdentifiers.
The macro will perform syntax normalization of the tag.
Examples
use ;
const DE_AT: LanguageIdentifier = langid!;
let de_at: LanguageIdentifier = "de-at".parse.unwrap;
assert_eq!;
Note: The macro cannot produce language identifiers with more than one variants due to const
limitations (see Heap Allocations in Constants):
icu::locale::langid!("und-variant1-variant2");
Use runtime parsing instead:
"und-variant1-variant2"
.
.unwrap;