Yatapp v0.2.3 Yatapp View Source
Yata integration hex package.
Link to this section Summary
Functions
Search for translation in given locale
based on provided key
Link to this section Functions
Link to this function
locale() View Source
Link to this function
translate(locale, key, values \\ %{}) View Source
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.translate("en", "hello")
"Hello world"
iex> Yatapp.translate("en", "hello_name", name: "Joe")
"Hello Joe"
iex> Yatapp.translate("en", "invalid")
** (ArgumentError) Missing translation for key: en.invalid
iex> Yatapp.translate("en", "hello_name", name: %{"1" => "2"})
** (ArgumentError) Only string, boolean or number allowed for values.