ca1989

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

BartOtten

You could propose they clarify the instructions. You are not the first on (neither was I) who tripped over this :slight_smile:

Merge .pot into all locales
mix gettext.merge priv/gettext

It never mentions when or where ‘all locales’ are defined.

BartOtten

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

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

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},

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New

We're in Beta

About us Mission Statement