LanguageList (language_list v1.0.2) View Source

An Elixir implementation of the language_list ruby gem.

Link to this section Summary

Functions

Returns all common data.

Returns all language data.

Returns list of all common languages.

Allows for query of language data by attribute.

Returns list of all language names.

Link to this section Functions

Returns all common data.

Examples

iex> LanguageList.all_common_data
{
  :ok,
  [
    %{common: true, iso_639_1: "af", iso_639_3: "afr", name: "Afrikaans"},
    %{common: true, iso_639_1: "ar", iso_639_3: "ara", name: "Arabic"},
    ...
  ]
}

Returns all language data.

Examples

iex> LanguageList.all_data
{
  :ok,
  [
    %{common: false, iso_639_1: "az", iso_639_3: "aze", name: "Azerbaijani"},
    %{common: false, iso_639_1: "ba", iso_639_3: "bak", name: "Bashkir"},
    ...
  ]
}

Returns list of all common languages.

Examples

iex> LanguageList.common_languages
{:ok, ["Afrikaans", "Arabic", "Bengali", "Tibetan", "Bulgarian", ...]}

Allows for query of language data by attribute.

Permitted keys: :name , :iso_639_3 , :iso_639_1

Examples

iex> LanguageList.find("Icelandic", :name)
{:ok, %{common: true, iso_639_1: "is", iso_639_3: "isl", name: "Icelandic"}}

iex> LanguageList.find("pt", :iso_639_1)
{:ok, %{common: true, iso_639_1: "pt", iso_639_3: "por", name: "Portuguese"}}

iex> LanguageList.find("por", :iso_639_3)
{:ok, %{common: true, iso_639_1: "pt", iso_639_3: "por", name: "Portuguese"}}

iex> LanguageList.find("non-existent-language", :name)
{:error, "No matches found"}

Returns list of all language names.

Examples

iex> LanguageList.languages
{:ok, ["Afar", "Abkhazian", "Afrikaans", "Akan", "Amharic", "Arabic", ...]}