<!--
This file was generated by Spark. Do not edit it by hand.
-->
# AshGettext.Domain

Declares, once per Ash domain, how its action errors are translated.

    defmodule MyApp.Shop do
      use Ash.Domain, extensions: [AshGettext.Domain]

      gettext do
        backend MyApp.Gettext
        default_locale "en"
        text_domain "ash"
        locale_resolver MyApp.Locale
      end

      resources do
        resource MyApp.Shop.Order
      end
    end

Configuration lives here rather than in `config.exs` on purpose. Ash configures
through DSL and passes request-scoped data through action context; global
application env would be process-wide mutable state, which forces
`Application.put_env` in tests and rules out `async: true`. Everything here is
read back through `AshGettext.Info`.

The supported locale list is deliberately *not* an option — it is derived from
the backend via `AshGettext.known_locales/1`, so it cannot drift from the
catalogs actually on disk.

Repeating this block across many domains is avoided the same way Ash avoids it
elsewhere: put it in a base domain macro and `use` that instead.


## gettext
Configure how the errors of this domain's actions are translated.



### Examples
```
gettext do
  backend MyApp.Gettext
  default_locale "en"
  text_domain "ash"
end

```




### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`backend`](#gettext-backend){: #gettext-backend .spark-required} | `atom` |  | The Gettext backend whose catalogs this domain translates against. |
| [`locale_resolver`](#gettext-locale_resolver){: #gettext-locale_resolver .spark-required} | `module` |  | Required. A module implementing `AshGettext.Locale.Resolver`. It reads the language from the action's actor. With no actor, Gettext's current process language is used. |
| [`default_locale`](#gettext-default_locale){: #gettext-default_locale } | `String.t` | `"en"` | The locale used when the resolver names a language the catalogs do not have. |
| [`text_domain`](#gettext-text_domain){: #gettext-text_domain } | `String.t` | `"ash"` | The gettext text domain for everything Ash-derived: errors, enum labels, attribute names. |
| [`translate_errors?`](#gettext-translate_errors?){: #gettext-translate_errors? } | `boolean` | `true` | Whether resources in this domain translate their action errors. |
| [`require_resource_extension?`](#gettext-require_resource_extension?){: #gettext-require_resource_extension? } | `boolean` | `false` | When true, compiling the domain reports every resource in its `resources` block that lacks the `AshGettext.Resource` extension (a compiler warning, an error under `--warnings-as-errors`). Off by default on purpose: Ash extensions are opted into, never imposed. |







<style type="text/css">.spark-required::after { content: "*"; color: red !important; }</style>
