exi18n v0.9.0 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> ExI18n.t("en", "hello")
"Hello world"

iex> ExI18n.t("en", "hello_name", name: "Joe")
"Hello Joe"

iex> ExI18n.t("en", "invalid")
** (ArgumentError) Missing translation for key: invalid

iex> ExI18n.t("en", "incomplete.path")
** (ArgumentError) incomplete.path is incomplete path to translation.

iex> ExI18n.t("en", "hello_name", name: %{"1" => "2"})
** (ArgumentError) Only string, boolean or number allowed for values.
Link to this function

t(locale, key, values)

View Source
t(String.t(), String.t(), map()) :: String.t()