Yatapp v0.1.4 Yatapp.ExI18n View Source
ExI18n - key-based internationalization library.
Link to this section Summary
Functions
Flag to determine if fallback to default locale
Default locale set in configuration
Supported locales
Search for translation in given locale
based on provided key
Link to this section Functions
Flag to determine if fallback to default locale.
Default locale set in configuration.
Supported locales.
Search for translation in given locale
based on provided key
.
Parameters
locale
:String
with name of locale.key
:String
with path to translation.values
:Map
with values that will be interpolated.
Examples
iex> Yatapp.ExI18n.t("en", "hello")
"Hello world"
iex> Yatapp.ExI18n.t("en", "hello_name", name: "Joe")
"Hello Joe"
iex> Yatapp.ExI18n.t("en", "invalid")
** (ArgumentError) Missing translation for key: invalid
iex> Yatapp.ExI18n.t("en", "incomplete.path")
** (ArgumentError) incomplete.path is incomplete path to translation.
iex> Yatapp.ExI18n.t("en", "hello_name", name: %{"1" => "2"})
** (ArgumentError) Only string, boolean or number allowed for values.