Use language codes

ISO 639 language codes are available across several types implementing Parts 1, 2, 3 and 5 of the standard.

Because the ISO 639 standard does not define numeric counterparts for its language codes, these types are not C# enums. Instead each is a readonly struct in which every language code is a static member whose string value is the code from the standard. See Understanding the ISO 639 parts for more on this design.

To access an ISO 639 Part 1 language code, use the Iso639Part1Language type:

var englishLanguage = Iso639Part1Language.en;

For historical reasons, ISO 639 Part 2 was defined in two forms, providing codes for both bibliographic and terminological purposes. Both forms are available:

var englishLanguage = Iso639Part2BLanguage.eng; // bibliographic code for English

or,

var englishLanguage = Iso639Part2TLanguage.eng; // terminological code for English

Similarly, the language codes defined by ISO 639 Part 3 are available in their own type:

var phuThaiLanguage = Iso639Part3Language.pht;

Language families and groups have a type for ISO 639 Part 5:

var caucasianLanguages = Iso639Part5LanguageFamily.cau;

Next steps


This site uses Just the Docs, a documentation theme for Jekyll.