# `Localize.HTML`
[🔗](https://github.com/elixir-localize/localize_web/blob/main/lib/localize/html.ex#L1)

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, territory subdivisions, locales, units of measure, and months. Each helper localizes display names according to the current or specified locale using the [Localize](https://hex.pm/packages/localize) library.

## Delegate Functions

* `currency_select/3` and `currency_options/1` — see `Localize.HTML.Currency`.

* `territory_select/3` and `territory_options/1` — see `Localize.HTML.Territory`.

* `subdivision_select/3` and `subdivision_options/1` — see `Localize.HTML.Subdivision`.

* `locale_select/3` and `locale_options/1` — see `Localize.HTML.Locale`.

* `unit_select/3` and `unit_options/1` — see `Localize.HTML.Unit`.

* `month_select/3` and `month_options/1` — see `Localize.HTML.Month`.

* `message/1` — renders an MF2 message with inline markup, see `Localize.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}!")}`.

# `currency_options`

# `currency_select`

# `locale_options`

# `locale_select`

# `message`

# `month_options`

# `month_select`

# `subdivision_options`

# `subdivision_select`

# `t`
*macro* 

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.Gettext

### Arguments

* `msgid` is an MF2 message string literal. May contain Elixir
  `#{expr}` interpolations.

* `options` is a keyword list of options (only `t/2`).

### Options

* `:locale` overrides the current locale for this render only.
  The default is `Localize.get_locale/0`.

* `:components` is 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)}

# `t`
*macro* 

# `territory_options`

# `territory_select`

# `unit_options`

# `unit_select`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
