Crate lang_id

source ·
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::map::max::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::map::min::min_map();

let sg = map.get("zh-Hans-SG");
assert_eq!(sg, Some(&"zh-SG"));

Get description of a language:

let map = lang_id::map::description::desc_map();
let ja = map.get("ja");
assert_eq!(ja, Some(&"日本語, 日本語の文字, 日本"));

Modules

  • getmatch
  • mapmap
  • sys_langsys-lang
    The sys-lang module is used to get the current system’s locale and convert it into LangID.

Type Definitions