How do you manage translations of Phoenix projects?

Hi all,
I am using Gettext to handle translations of Phoenix projects, it’s working great.
But I am not 100% happy about I organize my translated strings.

I have dgettext calls scattered around, and I know it’s perfectly fine, as the job of Gettext extract is exactly to fetch and group them.

But I don’t know, I still find a bit verbose: dgettext("domain", "Some %{arg} message", %{arg: "cool"}).
Also, there are cases where I use module attributes to messages used multiple times in the module (if they don’t have args).
There are cases where I use functions, because of the args.

So, I would like to know how do you organize them, if you have smart helpers or macros…?

I can’t stop thinking about a gigantic module that contains every single translation where I can address the translation with an atom. Is that silly?


There are translation systems, which use synthetic keys instead of the “to be translated” strings. I personally never found them appealing, but you’re not alone with that idea. You can even mimic that with gettext (just use the synthetic key as the string), but that usually means translates get to see that key instead of the to be translated text.