ex_cldr_languages is an addon library application for ex_cldr that provides localization and listing of languages.
The primary api is MyApp.Backend.Language.to_string/2
. The following examples demonstrate:
iex> MyApp.Backend.Language.to_string "en-GB"
{:ok, "British English"}
iex> MyApp.Backend.Language.to_string "en-GB", style: :short
{:ok, "UK English"}
iex> MyApp.Backend.Language.to_string "en", locale: "de"
{:ok, "Englisch"}
def deps do
[
{:ex_cldr_languages, "~> 0.3.0"}
]
end
With the switch to ex_cldr
v2 any functionality is now to be called via MyApp.Backend.Language
instead of Cldr.Language
. This breaking change was
also used to remove all_languages/0
in favor of available_languages/0
.