1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*!
This library provides a series of const lang-ids (language identifiers) 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:
```
# #[cfg(feature = "consts")] {
use lang_id::LangID;
// Compile-time verified language ID
const DEFAULT_LANG: LangID = lang_id::consts::lang_id_en();
# }
```
Description-data Lookup (requires map feature)
```
# #[cfg(feature = "map")]
# {
let map = lang_id::maps::description::map();
let gsw_fr = map.get("gsw-FR");
assert_eq!(gsw_fr, Some(&"Schwiizertüütsch, Latiinisch, Frankriich"));
let zh = map.get("zh");
assert_eq!(zh, Some(&"简体中文, 中国"));
let ja = map.get("ja");
assert_eq!(ja, Some(&"日本語, 日本語の文字, 日本"));
# }
```
## Features
| Feature | Dependencies | Description |
| -------------- | --------------------- | -------------------------------------------------------------------------------------------------------------- |
| **std** | None | Enables stdlib integrations |
| **map** | `phf`, `tinystr` | Adds precomputed static maps:<br>- Perfect hash maps for O(1) lookups<br>- Compact string storage with TinyStr |
| **sys-locale** | `sys-locale`, **std** | System locale detection:<br>- Cross-platform locale querying<br>- Integration with OS settings |
| **match** | None | Match the value or function name in consts using bytes, for example, b"en-001" => lang_id_en_001(). |
| **serde** | `unic-langid/serde` | Serialization/deserialization support |
| **consts** | None | Provides const language ids |
*/
pub use RawID;
pub use LanguageIdentifier as LangID;
pub use LangidResult as Result;
/// The sys-locale module is used to get the current system's locale and convert
/// it into LangID.