ISO639.to_iso639_2

You're seeing just the function to_iso639_2, go back to ISO639 module for more information.

Specs

to_iso639_2(language_code :: String.t()) :: String.t() | 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