# `AshGettext.Enum`
[🔗](https://github.com/Undeadlol1/ash_gettext/blob/v0.1.0/lib/ash_gettext/enum.ex#L1)

An `Ash.Type.Enum` whose `label/1` and `description/1` come back translated.

    defmodule MyApp.Order.Status do
      use AshGettext.Enum,
        backend: MyApp.Gettext,
        values: [
          placed: [label: "Order placed"],
          awaiting_pickup: [label: "Ready for pickup", description: "Ready at the pickup point"]
        ]
    end

    MyApp.Order.Status.label(:awaiting_pickup)
    #=> "Ожидает выдачи"

It calls `use Ash.Type.Enum` for you with the same `values:`, so the module
is an ordinary Ash enum. The text you write is the msgid, so the source
language needs no catalog, and `mix gettext.extract` finds every label and
description.

Every value needs a `label:` you wrote. The library never makes one from the
value's name, so a value without one is a compile error. Descriptions are
optional. An empty value (`nil`) has no label and no description. The
language is Gettext's current locale for the process; choose it with
`Gettext.with_locale/3`. A loaded `<attribute>_label` uses the actor's
language instead. A missing translation
returns the source text and emits the `[:ash_gettext, :translation, :missing]`
telemetry event.

## Options

  * `:backend` - required; your Gettext backend.
  * `:values` - required; the values, as for `Ash.Type.Enum`, each with a
    `label:`.
  * `:text_domain` - the catalog the texts live in. Defaults to `"ash"`.

---

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