# `AshGettext.ErrorTranslation.ErrorHandler`
[🔗](https://github.com/Undeadlol1/ash_gettext/blob/v0.1.0/lib/ash_gettext/error_translation/error_handler.ex#L1)

The `error_handler` that `AshGettext.Resource` installs on write actions.

Ash calls this with the changeset and each error it collects, and takes the
return value as the error to keep. The error is translated into the language
of the action's actor, else Gettext's current language.

It sits below every transport by design. An error from a custom validation,
a builtin constraint, a value that does not cast, a missing required value or
a failed policy all arrive here the same way. Errors the data layer returns
after the change ran (a stale record) do not pass through it.

If the domain does not configure `gettext`, the error passes through untouched.

# `translate_error`

```elixir
@spec translate_error(Ash.Changeset.t(), term()) :: term()
```

Translate `error` into the action's language.

---

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