LCID-rs: A Rust library for Windows Language Code Identifiers
This library provides language code identifier parsing and information according to the MS-LCID "Windows Language Code Identifier (LCID) Reference".
[]
= "0.1"
It currently tracks the 14.1/2021-07-04 protocol revision. Future protocol revisions will may only trigger a minor version bump, so if you need a specific revision, pin this crate accordingly.
Language identifiers can be queried from a 32-bit unsigned integer (Language Code Identifier, or LCID) or a string (name, i.e. supported IETF BCP 47 language tag):
use LanguageId;
use TryInto;
prints
LCID 1033 is 'en-US'/'English (United States)'
Name 'en-US' is 1033/'English (United States)'
How the information was generated
First, information was extracted from the MS-LCID PDF, and from both HTML tables of the associated LCIDs ("numbered") and the unassociated LCIDs ("named"). This was then manually cleaned, converted to JSON, and compared.
Then, the GetCultureInfo.ps1 script was run on a Windows Server 2019 machine (Build 17763) to gather further information from the System.Globalization.CultureInfo API. The values returned by the API do not always match the information in MS-LCID, so some fix-up were applied. For details, please see the script.
Finally, the lcid-gen crate generates code for the lcid crate (src/gen.rs). This is done to avoid having a build-time dependency on the JSON files.
MS-LCID errata
- "es-CU" is listed as
0x5C0Ain the Language ID table, and in the Locale Names without LCIDs table as0x1000. - "ff-Latn-GM" is misprinted as "ff-latn-GM" (lower-case "l").
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.