A dictionary for one language: the English strings of the interface (and of your blocks) mapped to their translation.
The library ships Spanish, Portuguese, German, French, Italian and Japanese.
Your app adds its own with modules like this one, usually generated by
mix elementorex.gen.locale:
defmodule MyAppWeb.ElementorexLocales.Pt do
use ElementorexCms.I18n.Locale, locale: "pt", name: "Português"
@impl true
def dictionary do
%{
"Pricing" => "Preços",
# nil (or a missing key) falls back to the built-in translation,
# then to English
"Most popular" => nil
}
end
end
config :elementorex_cms, locales: [MyAppWeb.ElementorexLocales.Pt]A module for a locale the library already ships is merged on top of the
built-in dictionary (its entries win); a module for a new locale ("ko", "nl"…)
makes that language available.
Summary
Callbacks
English text → translation. nil values are ignored.
The locale code, such as "pt" or "ja".
The name of the language in that language ("Português"), for switchers.