View Source IsoLang (iso_lang v0.4.0)
Documentation for IsoLang
.
Provides utilities for dealing with ISO 639 languages.
see-also
See Also
Link to this section Summary
Functions
Returns a list of all available ISO language codes.
Searches for matching languages using a case-insensitive query string
As find/2
, but raises on error
Gets a single language struct identified by a field.
If the :by
field is not specified, fields are checked in the following order
As get/2
, but raises on error
Link to this section Types
Link to this section Functions
Returns a list of all available ISO language codes.
Searches for matching languages using a case-insensitive query string
options
Options
:by
specifies which struct field to be used in the search. One of:alpha2
,:alpha3b
,:alpha3t
,:name
. Default::name
examples
Examples
iex> IsoLang.find("eng")
{:ok,
[
%IsoLang{
alpha2: "",
alpha3b: "ang",
alpha3t: "",
name: "English, Old (ca.450-1100)",
native_name: nil
},
%IsoLang{
alpha2: "bn",
alpha3b: "ben",
alpha3t: "",
name: "Bengali",
native_name: "বাংলা"
},
# ... etc...
]
}
As find/2
, but raises on error
Gets a single language struct identified by a field.
If the :by
field is not specified, fields are checked in the following order:
:alpha2
:alpha3b
:alpha3t
:name
Keep in mind that the :alpha2
(2-character codes) and :alpha3b
(3-character codes)
are the most common -- not every language defines a :alpha3t
code.
options
Options
:by
specifies which struct field to be used in the search. One of:alpha2
,:alpha3b
,:alpha3t
,:name
. (optional; default will examine all fields for a match in the order indicated above)
examples
Examples
iex> IsoLang.get("de")
{:ok,
%IsoLang{
alpha2: "de",
alpha3b: "ger",
alpha3t: "deu",
name: "German",
native_name: "Deutsch"
}}
As get/2
, but raises on error