How To Use Elixir Gettext As A Team — Tentamen Software Testing Blog

TL;DR

You are working on a Phoenix application that uses Elixir Gettext for translations. As all team members are doing changes on translation files, you have a lot of merging conflicts on those files. In the end, you sometimes lose some translations in variable from translation files.

Elixir Gettext

Elixir Gettext is a library for managing translations in your web application. Workflow is very simple:

  1. use
  2. sync code with translation files using
  3. Add translation to file, here is a German example:

gettext knows which string to use based on assign in session, eg. or

Teamwork

You will probably work in a team where each member pushes to branch new code through . Your files are getting bigger and bigger, and there is 100% for merge conflict on those files. You will try to resolve to merge conflict (you must break the first rule of , do not edit files by hand). You start you and you get the error:

Good luck with that!

Solution

The solution is very simple, use which will put translation to domain_1 files. Let each team member has its own domain for translations. No more merge conflicts and long hours resolving them (and losing translations in ).

Originally published at https://blog.tentamen.eu on April 19, 2021.

Founder of Tentamen, software testing agency.

Founder of Tentamen, software testing agency.