Copies Ash's .pot file into your application's priv/gettext/ directory.
This allows you to create locale-specific .po files for translating
Ash error messages using the standard gettext workflow.
Usage
$ mix ash.gen.gettext
$ mix ash.gen.gettext --domain errors
Options
--domain/-d— Target gettext domain. Defaults to"ash".When set to a domain other than
"ash"(e.g.,"errors"), Ash's translatable messages are merged into the existingpriv/gettext/<domain>.potfile. The Ash entries are placed after a marker comment and replaced on each run, making this operation idempotent. Multiple libraries (e.g.,ash,ash_authentication) can each maintain their own marked section in the same file.This is useful when your application already translates errors under the
"errors"domain and you want Ash messages available there without changing yourtranslate_error/1code.
Workflow
Default (ash domain)
Run
mix ash.gen.gettextto copyash.potinto yourpriv/gettext/.Run
mix gettext.merge priv/gettext --locale koto createpriv/gettext/ko/LC_MESSAGES/ash.po.Fill in the
msgstrvalues in the.pofile.In your
translate_error/1, call:Gettext.dgettext(MyApp.Gettext, "ash", msg, vars)
Custom domain (e.g., errors)
- Run
mix ash.gen.gettext --domain errorsto merge Ash messages into your existingpriv/gettext/errors.pot. - Run
mix gettext.merge priv/gettext --locale koas usual. - Your existing
translate_error/1usingdgettext(backend, "errors", ...)works without changes.