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

Read a domain's `gettext do ... end` configuration.

`Spark.InfoGenerator` supplies the per-option readers — `gettext_backend/1`,
`gettext_default_locale/1`, `gettext_text_domain/1`, `gettext_locale_resolver/1`,
`gettext_translate_errors?/1` — each returning `{:ok, value}` or `:error`, plus
raising `!` variants.

On top of those, `settings/1` answers the one question every caller actually
has: *is this domain set up to translate, and with what?*

# `settings`

```elixir
@type settings() :: %{
  backend: module(),
  default_locale: String.t(),
  text_domain: String.t(),
  locale_resolver: module() | nil,
  supported_locales: [String.t()]
}
```

Everything needed to translate for a domain.

# `attribute_label`

```elixir
@spec attribute_label(module(), atom()) :: String.t() | nil
```

The written label of a resource's attribute from its `gettext` block, or `nil`.

# `attribute_labels`

```elixir
@spec attribute_labels(module()) :: [{atom(), String.t()}]
```

Every written attribute label of a resource, as `{attribute, text}`.

# `gettext_backend`

```elixir
@spec gettext_backend(dsl_or_extended :: module() | map()) :: {:ok, atom()} | :error
```

The Gettext backend whose catalogs this domain translates against.

# `gettext_backend!`

```elixir
@spec gettext_backend!(dsl_or_extended :: module() | map()) :: atom() | no_return()
```

The Gettext backend whose catalogs this domain translates against.

# `gettext_default_locale`

```elixir
@spec gettext_default_locale(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error
```

The locale used when the resolver names a language the catalogs do not have.

# `gettext_default_locale!`

```elixir
@spec gettext_default_locale!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()
```

The locale used when the resolver names a language the catalogs do not have.

# `gettext_locale_resolver`

```elixir
@spec gettext_locale_resolver(dsl_or_extended :: module() | map()) ::
  {:ok, module()} | :error
```

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.

# `gettext_locale_resolver!`

```elixir
@spec gettext_locale_resolver!(dsl_or_extended :: module() | map()) ::
  module() | no_return()
```

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.

# `gettext_options`

```elixir
@spec gettext_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) =&gt; any()
}
```

gettext DSL options

Returns a map containing the and any configured or default values.

# `gettext_require_resource_extension?`

```elixir
@spec gettext_require_resource_extension?(dsl_or_extended :: module() | map()) ::
  boolean()
```

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.

# `gettext_text_domain`

```elixir
@spec gettext_text_domain(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error
```

The gettext text domain for everything Ash-derived: errors, enum labels, attribute names.

# `gettext_text_domain!`

```elixir
@spec gettext_text_domain!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()
```

The gettext text domain for everything Ash-derived: errors, enum labels, attribute names.

# `gettext_translate_errors?`

```elixir
@spec gettext_translate_errors?(dsl_or_extended :: module() | map()) :: boolean()
```

Whether resources in this domain translate their action errors.

# `language`

```elixir
@spec language(module() | map(), term()) :: {module(), String.t()} | nil
```

The `{backend, locale}` to use for `actor`, or `nil` for Gettext's current language.

Asks the domain's `locale_resolver` with the actor and fits the answer to the
catalogs. `nil` when there is no actor or the resolver returns
`nil`. Nothing here changes the process language.

# `locale_settings`

```elixir
@spec locale_settings(module() | map()) :: {:ok, settings()} | :error
```

The domain's gettext settings, whether or not error translation is on.

`:error` only when the domain has no `gettext` block. Used to find the
backend, text domain and language rules for enums, attributes and the
action's language.

# `settings`

```elixir
@spec settings(module() | map()) :: {:ok, settings()} | :error
```

The domain's translation settings, or `:error` when it does not translate.

Returns `:error` both for a domain without the `AshGettext.Domain` extension
and for one that has explicitly set `translate_errors? false`, so a caller can
treat "not configured" and "switched off" the same way — pass the value through
untouched.

---

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