`priv/gettext/errors.pot` is only extracted once


  • OS: macOS Big Sur
  • Elixir: 1.11.3
  • Erlang/OTP: 23
  • phx.new: 1.5.8


Create a demo app:

$ mix phx.new demo

Extract POT files:

$ cd demo
$ mix gettext.extract
Compiling 14 files (.ex)
Generated demo app
Extracted priv/gettext/default.pot
Extracted priv/gettext/errors.pot

As you see, priv/gettext/errors.pot is extracted. It works as expected.

Next, I removed priv/gettext and rerun mix gettext.extract:

$ rm -rf priv/gettext
$ mix gettext.extract
Compiling 14 files (.ex)
Extracted priv/gettext/default.pot

Only, default.pot is extracted, errors.pot is missing here.

I guessed that it could be the problem of ‘magic’ cache. Then, I removed _build and deps, rerun:

$ rm -rf _build deps priv/gettext
$ mix deps.get
$ mix gettext.extract
Compiling 14 files (.ex)
Extracted priv/gettext/default.pot

Oops, same result.

I am confused, why is priv/gettext/errors.pot extracted only once?

errors.pot is never extracted. It‘s generated by mix phx.new. The strings listed in it come from ecto, which doess not natively integrate with gettext, therefore translations need to be dynamic as opposed to static.


Thanks. I have found the orginal file -
phoenix/errors.pot at master · phoenixframework/phoenix · GitHub

But I have another question, how is this file maintained?
Edit it manually everytime Ecto updates or Sync it with some script?



Got it.