Facade module providing HTML form select helpers for localized data.
This module delegates to specialized submodules that generate <select> tags and option lists for currencies, territories, locales, units of measure, and months. Each helper localizes display names according to the current or specified locale using the Localize library.
Delegate Functions
currency_select/3andcurrency_options/1— seeLocalize.HTML.Currency.territory_select/3andterritory_options/1— seeLocalize.HTML.Territory.locale_select/3andlocale_options/1— seeLocalize.HTML.Locale.unit_select/3andunit_options/1— seeLocalize.HTML.Unit.month_select/3andmonth_options/1— seeLocalize.HTML.Month.message/1— renders an MF2 message with inline markup, seeLocalize.HTML.Message.t/1,t/2— compile-time MF2 translation macro for HEEx templates. Combines Gettext lookup with MF2 interpolation and markup rendering in one call:{t("Hello, #{@user.name}!")}.
Summary
Functions
Translates an MF2 message at compile time and renders it (including inline markup) at runtime.
Functions
Translates an MF2 message at compile time and renders it (including inline markup) at runtime.
This is the macro-form equivalent of ~t + <.message> combined.
Suitable for use directly inside HEEx body interpolation:
<h1>{t("Hello, #{@user.name}!")}</h1>
<p>{t("By signing up you accept our {#link navigate=|/terms|}terms{/link}.")}</p>Elixir-style #{expr} interpolations are rewritten as MF2 {$name}
placeholders at compile time using the same key-derivation rules as
the ~t sigil (see Localize.Message.Sigils). The canonical msgid
is registered with Gettext for translation extraction; at runtime the
translated message is walked via
Localize.Message.format_to_safe_list/3 so MF2 markup tags such as
{#bold}…{/bold} and {#link href=…}…{/link} are dispatched to the
Phoenix function components registered with Localize.HTML.Message.
The calling module must opt in with:
use Localize.Message.Sigils, backend: MyApp.GettextArguments
msgidis an MF2 message string literal. May contain Elixir#{expr}interpolations.optionsis a keyword list of options (onlyt/2).
Options
:localeoverrides the current locale for this render only. The default isLocalize.get_locale/0.:componentsis a map of%{markup_name => renderer_fun}that overrides the default markup component registry for this render only. The default is%{}.
Returns
- A
Phoenix.HTML.safe()value suitable for HEEx interpolation.
Examples
{t("Hello, world!")}
{t("Hello, #{name}!")}
{t("Read {#bold}#{count} item(s){/bold}")}
{t("Click {#link patch=|/x|}here{/link}", locale: :fr)}