ca1989
Not able to extract translations with gettext
Hi all,
I am not able to extract translation strings into a pot file using the mix gettext.extract task.
The task exits without errors, but does nothing.
I am following the README at GitHub - elixir-gettext/gettext: Internationalization and localization support for Elixir.
I set up a basic mix project to test it out:
PS: it works fine in a Phoenix project, so I am suspecting some black magic going on…?
Most Liked
BartOtten
You could propose they clarify the instructions. You are not the first on (neither was I) who tripped over this ![]()
Merge .pot into all locales
mix gettext.merge priv/gettext
It never mentions when or where ‘all locales’ are defined.
BartOtten
Did you run mix gettext.merge priv/gettext --locale {locale} to create a locales’ folder? This creates a priv/gettext/{locale} folder with the files.
Once you have done so for each locale you want to support, you can use mix gettext.extract --merge.
linusdm
If you’re on elixir 1.15 then I think you’re running into this issue: Running `mix gettext.extract` doesn't extract new messages with Elixir 1.15 · Issue #367 · elixir-gettext/gettext · GitHub
It’s fixed on the main branch, but not yet released. You can temporarily depend on the github version in your mix.exs, it my hypothesis is correct.
You don’t need to configure :priv (and :default_locale?) if they are default like that. You probably triggered a full recompilation somehow.
If you’re not on Elixir 1.15 then all the above doesn’t hold.
petrus-jvrensburg
Thanks @linusdm !
Yes, that was it. I installed the latest main then it started working as expected, without needing to specify a default locale / directory.
So the workaround at the moment: In mix.exs, install the latest gettext as
{git: "https://github.com/elixir-lang/gettext.git", branch: "main", override: true},







