Crate lcid[][src]

Expand description

This crate provides language information and lookups from Microsoft’s numeric language code identifiers (LCIDs) or language names (IETF language tags, BCP 47), similar to - but more limited than - the System.Globalization.CultureInfo class in .NET. The lookup follows the MS-LCID “Windows Language Code Identifier Reference” specification. Sort IDs are not supported yet.

Examples

use lcid::LanguageId;
use std::convert::TryInto;

let lang: &LanguageId = 1033.try_into().unwrap();
assert_eq!(lang.name, "en-US");

let lang: &LanguageId = "en-US".try_into().unwrap();
assert_eq!(lang.lcid, 1033);

Modules

constants

Contains all defined LanguageId returned by the lookups.

Structs

LanguageId

A language’s identifiers and information. Lookups from numeric or named identifiers return a reference to statically defined LanguageId.

Enums

AnsiCodePage

A known ANSI code page. Some languages can be encoded using one of these code pages. This enum has a u32 representation, and so can be converted to the numeric code page value if needed.

LcidLookupError

Errors when looking up a LanguageId from a numeric (u32) LCID via TryFrom or TryInto.

NameLookupError

Errors when looking up a LanguageId from a named identifier via TryFrom or TryInto.