macro_rules! langid {
    ($langid:literal) => { ... };
Expand description

A macro allowing for compile-time construction of valid LanguageIdentifiers.

The macro will perform syntax canonicalization of the tag.


use icu::locid::{langid, LanguageIdentifier};

const DE_AT: LanguageIdentifier = langid!("de_at");

let de_at: LanguageIdentifier = "de_at".parse().unwrap();

assert_eq!(DE_AT, de_at);

Note: The macro cannot produce language identifiers with more than one variants due to const limitations (see Heap Allocations in Constants):


Use runtime parsing instead: