The words of the pickers: placeholders, button labels, announcements for screen readers and the messages of a refused choice.
Numbers come from the browser (Intl), in any locale. The words are
here, in English,
Portuguese, Spanish, French, German, Italian, Dutch and Japanese; a
locale with a region (pt-BR, en-GB) takes the words of its language,
and another language gets English.
Give a picker other words with messages, a map from the keys of
keys/0 to the new words, for example to use your own Gettext
translations:
<.select field={@form[:status]} options={@statuses} messages={%{"choose" => gettext("Status…")}} />Or set them for every picker in the config:
config :erabi, messages: %{"fr" => %{"choose" => "Sélectionner…"}}A word may have placeholders in braces ({n}, {label}), which the
picker fills. The keys that end in One and Other are the plural
forms of a count, picked with the plural rules of the locale.
Summary
Functions
The words for a locale: the built-in words of its language, then the
words of the config for the locale and for its language, then
overrides. Every key has a value (English when a language lacks one).
Returns the keys of the messages.
The language of a locale: "pt" for "pt-BR", "zh" for "zh_Hant".
Returns the languages with built-in words.
Functions
The words for a locale: the built-in words of its language, then the
words of the config for the locale and for its language, then
overrides. Every key has a value (English when a language lacks one).
Raises ArgumentError for an override with an unknown key, so that a
typo shows.
Examples
iex> Erabi.Messages.for_locale("pt-PT")["clear"]
"Limpar"
iex> Erabi.Messages.for_locale("sv")["clear"]
"Clear"
iex> Erabi.Messages.for_locale("en", %{"clear" => "Reset"})["clear"]
"Reset"
@spec keys() :: [String.t()]
Returns the keys of the messages.
Examples
iex> "choose" in Erabi.Messages.keys()
true
The language of a locale: "pt" for "pt-BR", "zh" for "zh_Hant".
Examples
iex> Erabi.Messages.language("pt-BR")
"pt"
@spec languages() :: [String.t()]
Returns the languages with built-in words.
Examples
iex> Erabi.Messages.languages()
["de", "en", "es", "fr", "it", "ja", "nl", "pt"]