Cadastre v0.1.1 Cadastre.Country View Source
Country implementation
Link to this section Summary
Functions
Returns all countries
Return all ids (ISO_3166-1)
Returns country name translation for locale
Returns %Cadastre.Country{}
for valid id
.
Returns nil
for invalid id
.
Link to this section Types
Link to this section Functions
Returns all countries
Examples
iex> Cadastre.Country.all() |> Enum.take(3)
[
%Cadastre.Country{id: "AD", name: "Andorra"},
%Cadastre.Country{id: "AE", name: "United Arab Emirates"},
%Cadastre.Country{id: "AF", name: "Afghanistan"}
]
iex> Cadastre.Country.all() |> Enum.count()
249
Return all ids (ISO_3166-1)
Examples
iex> Cadastre.Country.ids() |> Enum.take(10)
["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR"]
Link to this function
name(country, locale)
View Sourcename(t(), Cadastre.Language.id()) :: String.t()
Returns country name translation for locale
Examples
iex> Cadastre.Country.new("NL") |> Cadastre.Country.name("be")
"Нідэрланды"
iex> Cadastre.Country.new("NL") |> Cadastre.Country.name(":)")
"Netherlands"
iex> Cadastre.Country.name("something wrong", "be")
nil
Returns %Cadastre.Country{}
for valid id
.
Returns nil
for invalid id
.
Examples
iex> Cadastre.Country.new("NL")
%Cadastre.Country{id: "NL", name: "Netherlands"}
iex> Cadastre.Country.new("nl")
%Cadastre.Country{id: "NL", name: "Netherlands"}
iex> Cadastre.Country.new("xx")
nil