ExLang (ExLang v1.0.1)
Summary
Functions
Returns the text alignment.
Returns a list of matching language tags based on the inserted tag.
Lists all known ISO639-3 languages to Locales, ordered alphabetically by their language code
Translates a Locale.t()
.
Parses a locale into a struct.
Converts any tag to ISO639-3.
Attempts to create an RFC3066 compliant language description. If the code is expressed in iso6393 form, it probably creates an invalid tag.
Functions
Returns the text alignment.
Examples
iex> alignment(~L"ar")
:right_to_left
iex> alignment(~L"he")
:right_to_left
iex> alignment(~L"en")
:left_to_right
iex> alignment(~L"en-GB")
:left_to_right
Returns a list of matching language tags based on the inserted tag.
Examples
iex> filter([~L"de-DE", ~L"de-CH", ~L"deu", ~L"en-US"], ~L"de")
[~L"de-DE", ~L"de-CH", ~L"deu"]
iex> filter([~L"de-DE", ~L"de-CH", ~L"deu", ~L"en-US"], ~L"ger")
[~L"de-DE", ~L"de-CH", ~L"deu"]
iex> filter([~L"de-DE", ~L"de-CH"], ~L"de-DE")
[~L"de-DE"]
Lists all known ISO639-3 languages to Locales, ordered alphabetically by their language code
iex> ~L"deu" in iso6393_languages()
true
iex> ~L"eng" in iso6393_languages()
true
Translates a Locale.t()
.
Examples
iex> label(~L"de-DE")
"German (Germany)"
iex> label(~L"zh-CN")
"Chinese (China)"
iex> label(~L"deu")
"German"
iex> label(~L"zh")
"Chinese"
iex> label(~L"zh-HANS")
"Chinese (Simplified)"
iex> label(~L"zh-HANT")
"Chinese (Traditional)"
iex> label(~L"yue-Hant-HK")
"Yue Chinese (Traditional - Hong Kong)"
iex> label(~L"en")
"English"
iex> label(~L"und")
"Undetermined"
Parses a locale into a struct.
Examples
iex> parse!("de-DE")
~L"de-DE"
iex> parse!("en-gb")
~L"en-GB"
iex> parse!("deu")
~L"deu"
iex> parse!("ger")
~L"ger"
iex> parse!("yue-Hant-HK")
~L"yue-Hant-HK"
Converts any tag to ISO639-3.
Examples
iex> to_iso6393(~L"de-DE")
"deu"
iex> to_iso6393(~L"ger")
"deu"
iex> to_iso6393(~L"de")
"deu"
iex> to_iso6393(~L"en")
"eng"
Attempts to create an RFC3066 compliant language description. If the code is expressed in iso6393 form, it probably creates an invalid tag.
Examples
iex> to_rfc3066(~L"de-DE")
"de-DE"
iex> to_rfc3066(~L"de")
"de"
iex> to_rfc3066(~L"yue-Hant-HK")
"yue-Hant-HK"