API Reference AshGettext v#0.1.0

Copy Markdown View Source

Modules

Translate the text an Ash app shows: strings, plurals, enum labels and attribute labels.

The sentences shown for Ash's own errors, which carry no message of their own.

An Ash error whose text is now the translated sentence.

The translated label of an enum attribute, in the language of the query's actor. With no actor, Gettext's current locale.

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

Shows mix gettext.extract every text this domain's resources translate: written attribute labels, literal messages in their DSL and in the app's own validation, change and preparation modules they use, and the sentences for Ash's own errors (AshGettext.AshMessages). See AshGettext.Extractor.

Reports, at compile time, every resource of a domain that asked for it which never added AshGettext.Resource.

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

A user-visible failure with a stable code and a translatable message.

Turn an Ash error's message into the reader's language.

The error_handler that AshGettext.Resource installs on write actions.

Shows every text AshGettext translates to mix gettext.extract.

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

The source rewrites mix ash_gettext.install performs, as pure functions.

Reduce a locale as it arrives in the wild to one the catalogs actually have.

Reads a user's language from the actor.

Opts a resource into translated action errors, enum labels and attribute names.

Adds a public <attribute>_label calculation for every attribute whose type is an AshGettext.Enum (or a list of one). A resource that already has a field with that name keeps it.

Fails compilation when a label in the resource's gettext block names an attribute the resource does not have.

Mix Tasks

Wire this application into ash_gettext.