ISO639 (ISO639 v0.2.1) 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
List of available ISO-639-1 language codes.
List of available ISO-639-2 language codes.
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
expects as input downcased ISO 639-1, ISO 639-2 or ISO 639-2/B language code and returns ISO 639-2/B (Bibliographic) code if it exists in standard. 639-2 code is returned if bibliographic value doesn't exist. Default value is nil
for wrong argument situations.
Link to this section Functions
Specs
iso639_1_codes() :: [String.t()]
List of available ISO-639-1 language codes.
Exmaples
> ISO639.iso639_1_codes()
["aa", "ab", "ae", "af", "ak", "am", "an", "ar", "as", "av", "ay", "az", "ba",
"be", "bg", "bh", "bi", "bm", "bn", "bo", "br", "bs", "ca", "ce", "ch", ...]
Specs
iso639_2_codes() :: [String.t()]
List of available ISO-639-2 language codes.
Exmaples
> ISO639.iso639_2_codes()
["aar", "abk", "ace", "ach", "ada", "ady", "afa", "afh", "afr", "ain", "aka",
"akk", "ale", "alg", "alt", "amh", "ang", "anp", "apa", "ara", "arc", ...]
Specs
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
Specs
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
Specs
expects as input downcased ISO 639-1, ISO 639-2 or ISO 639-2/B language code and returns ISO 639-2/B (Bibliographic) code if it exists in standard. 639-2 code is returned if bibliographic value doesn't exist. Default value is nil
for wrong argument situations.
Examples
iex> ISO639.to_iso639_2b("hy")
"arm"
iex> ISO639.to_iso639_2b("eus")
"baq"
iex> ISO639.to_iso639_2b("chi")
"chi"
iex> ISO639.to_iso639_2b("cs")
"cze"
iex> ISO639.to_iso639_2b("de")
"ger"
iex> ISO639.to_iso639_2b("ud")
nil