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?
Summary
Types
Everything needed to translate for a domain.
Functions
The written label of a resource's attribute from its gettext block, or nil.
Every written attribute label of a resource, as {attribute, text}.
The Gettext backend whose catalogs this domain translates against.
The Gettext backend whose catalogs this domain translates against.
The locale used when the resolver names a language the catalogs do not have.
The locale used when the resolver names a language the catalogs do not have.
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.
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 DSL options
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.
The gettext text domain for everything Ash-derived: errors, enum labels, attribute names.
The gettext text domain for everything Ash-derived: errors, enum labels, attribute names.
Whether resources in this domain translate their action errors.
The {backend, locale} to use for actor, or nil for Gettext's current language.
The domain's gettext settings, whether or not error translation is on.
The domain's translation settings, or :error when it does not translate.
Types
Functions
The written label of a resource's attribute from its gettext block, or nil.
Every written attribute label of a resource, as {attribute, text}.
The Gettext backend whose catalogs this domain translates against.
The Gettext backend whose catalogs this domain translates against.
The locale used when the resolver names a language the catalogs do not have.
The locale used when the resolver names a language the catalogs do not have.
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.
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 DSL options
Returns a map containing the and any configured or default values.
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.
The gettext text domain for everything Ash-derived: errors, enum labels, attribute names.
The gettext text domain for everything Ash-derived: errors, enum labels, attribute names.
Whether resources in this domain translate their action errors.
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.
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.
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.