ISO639 v0.1.0 ISO639 View Source
This library exposes functions to convert ISO 639-1 language code representation to ISO 639-2 and backwards where it’s applicable. Data for conversions was taken from https://github.com/haliaeetus/iso-639. Note about ISO 639-2/B: all Bibliographic codes will be converted to ISO 639-2 codes
Link to this section Summary
Functions
expects as input downcased ISO 639-2 or ISO 639-2/B language code and returns ISO 639-1 code if it exists in standard and nil if not. If function receives as input ISO 639-1 language code, it’s returned unchanged
expects as input downcased ISO 639-1, ISO 639-2 or ISO 639-2/B language code and returns ISO 639-2 code if it exists in standard and nil if not. If function receives as input ISO 639-2 language code, it’s returned unchanged. ISO 639-2/B will be changed to ISO 639-2
Link to this section Functions
expects as input downcased ISO 639-2 or ISO 639-2/B language code and returns ISO 639-1 code if it exists in standard and nil if not. If function receives as input ISO 639-1 language code, it’s returned unchanged.
Examples
iex> ISO639.to_iso639_1("sag")
"sg"
iex> ISO639.to_iso639_1("en")
"en"
iex> ISO639.to_iso639_1("ace")
nil
expects as input downcased ISO 639-1, ISO 639-2 or ISO 639-2/B language code and returns ISO 639-2 code if it exists in standard and nil if not. If function receives as input ISO 639-2 language code, it’s returned unchanged. ISO 639-2/B will be changed to ISO 639-2
Examples
iex> ISO639.to_iso639_2("sag")
"sag"
iex> ISO639.to_iso639_2("sg")
"sag"
iex> ISO639.to_iso639_2("chi")
"zho"
iex> ISO639.to_iso639_2("en")
"eng"
iex> ISO639.to_iso639_2("ud")
nil