Translations of the editor interface and the built-in blocks.
Every user-facing string of the library is written in English and looked up
in the dictionary of the current locale when it is rendered. The library ships
Spanish ("es"); English is the default.
The locale is per process, like Gettext's: the editor sets it from its
locale attribute on every update, so the LiveView that hosts it renders in
that language. Outside the editor use put_locale/1 or configure a default:
config :elementorex_cms, locale: "es"Strings can be added or overridden per locale (for example the labels of your own blocks, or a whole new language):
config :elementorex_cms, :translations, %{
"es" => %{"Pricing table" => "Tabla de precios"},
"pt" => %{"Button" => "Botão"}
}
Summary
Functions
Locale of the current process, falling back to the configured default.
Locales with a built-in dictionary.
Sets the locale of the current process ("en", "es", ...).
Translates text to the current locale. bindings replace %{name}
placeholders after the lookup.
Functions
@spec locale() :: String.t()
Locale of the current process, falling back to the configured default.
@spec locales() :: [String.t()]
Locales with a built-in dictionary.
Sets the locale of the current process ("en", "es", ...).
Translates text to the current locale. bindings replace %{name}
placeholders after the lookup.
iex> ElementorexCms.I18n.put_locale("es")
iex> ElementorexCms.I18n.t("Button")
"Botón"
iex> ElementorexCms.I18n.t("%{count} items", count: 3)
"3 elementos"