# `Localize.Gettext.Interpolation`
[🔗](https://github.com/elixir-localize/localize/blob/v0.9.0/lib/localize/gettext/interpolation.ex#L1)

Gettext interpolation module for ICU MessageFormat 2 (MF2) messages.

Implements the `Gettext.Interpolation` behaviour so that MF2 messages
can be used in Gettext `.po`/`.pot` files. At compile time, messages
are parsed into an AST for efficient runtime formatting. At runtime,
bindings are interpolated using `Localize.Message`.

### Defining a Gettext module with MF2 interpolation

```elixir
defmodule MyApp.Gettext do
  use Gettext.Backend,
    otp_app: :my_app,
    interpolation: Localize.Gettext.Interpolation
end
```

Now Gettext macros will parse and format MF2 messages:

    import MyApp.Gettext

    gettext("{{Hello {$name}!}}", %{name: "World"})
    #=> "Hello World!"

### Options

The `use` macro accepts the following options:

* `:locale` - a default locale to use for formatting. When not set,
  the locale is resolved from `Gettext.get_locale/1` at runtime.

---

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