Expand description
This library provides a series of const lang-ids which can be found in the
consts module. Additionally, it provides some handy maps.
§Examples
Using the result of a const fn as a value:
use lang_id::LangID;
const DEFAULT_LANG: LangID = unsafe { lang_id::consts::get_en() };Maximize:
Note: Finding Maximized by max::map() does not enumerate all cases.
let map = lang_id::maps::max::map();
let zh = &map["zh"];
assert_eq!(zh.language, "zh");
assert_eq!(zh.script, "Hans");
assert_eq!(zh.region, "CN");Minimize:
let map = lang_id::maps::min::map();
let sg = map.get("zh-Hans-SG");
assert_eq!(sg, Some(&"zh-SG"));Get description of a language:
let map = lang_id::maps::description::map();
let gsw_fr = map.get("gsw-FR");
assert_eq!(gsw_fr, Some(&"Schwiizertüütsch, Latiinisch, Frankriich"));
let ja = map.get("ja");
assert_eq!(ja, Some(&"日本語, 日本語の文字, 日本"));Modules§
- consts
- error
- maps
map - matches
match - sys_
locale sys-locale - The sys-locale module is used to get the current system’s locale and convert it into LangID.
Structs§
- LangID
LanguageIdentifieris a core struct representing a Unicode Language Identifier.