mix ash_gettext.install (AshGettext v0.1.0)

Copy Markdown View Source

Wire this application into ash_gettext.

mix ash_gettext.install                    # preview every edit
mix ash_gettext.install --apply            # write them
mix ash_gettext.install --backend MyApp.Gettext --resolver MyApp.LocaleResolver

For each Ash domain it adds the AshGettext.Domain extension and a gettext do block naming this app's Gettext backend. A domain that already has the extension is skipped, so re-running is safe.

Options

  • --backend — the Gettext backend to translate against. Detected from the project when there is exactly one use Gettext.Backend.
  • --resolver — the module implementing AshGettext.Locale.Resolver that each domain names. Defaults to LocaleResolver in the backend's namespace, such as MyApp.LocaleResolver.
  • --text-domain — defaults to ash, so the texts go to ash.pot.
  • --apply — write the changes. Without it, nothing is written.

What this cannot do for you

The resolver module. Translating to the signed-in user's saved language needs code that knows where this app stores that, and a generic library must not assume it. The task prints a module to copy; write it, because the build fails until it exists.