Cadastre.Language (Cadastre v0.2.12) View Source

Language implementation.

Link to this section Summary

Functions

Returns all languages.

Returns all ids (ISO_639-2).

Returns language name translation for locale.

Returns language native name.

Returns %Cadastre.Language{} for valid id or nil for invalid id.

Link to this section Types

Specs

id() :: <<_::16>>

Specs

t() :: %Cadastre.Language{id: id()}

Link to this section Functions

Specs

all() :: [t()]

Returns all languages.

Examples

iex> Cadastre.Language.all() |> Enum.take(3)
[
  %Cadastre.Language{id: "aa"},
  %Cadastre.Language{id: "ab"},
  %Cadastre.Language{id: "ae"}
]

iex> Cadastre.Language.all() |> Enum.count()
179

Specs

ids() :: [id()]

Returns all ids (ISO_639-2).

Examples

iex> Cadastre.Language.ids() |> Enum.take(10)
["aa", "ab", "ae", "af", "ak", "am", "an", "ar", "as", "av"]

Specs

name(t(), id()) :: String.t()

Returns language name translation for locale.

Examples

iex> Cadastre.Language.new("nl") |> Cadastre.Language.name("be")
"галандская"

iex> Cadastre.Language.new("nl") |> Cadastre.Language.name(":)")
"Dutch"

iex> Cadastre.Language.name("something wrong", "be")
nil

Specs

native_name(t()) :: String.t()

Returns language native name.

Examples

iex> Cadastre.Language.new("nl") |> Cadastre.Language.native_name()
"Nederlands"

iex> Cadastre.Language.native_name("something wrong")
nil

Specs

new(id() | any()) :: t() | nil

Returns %Cadastre.Language{} for valid id or nil for invalid id.

Examples

iex> Cadastre.Language.new("nl")
%Cadastre.Language{id: "nl"}

iex> Cadastre.Language.new("NL")
%Cadastre.Language{id: "nl"}

iex> Cadastre.Language.new("xx")
nil