4

We are using Django and git. We have i18n enabled and run periodically compilemessages and makemessages. Everybody works in a separate branch and periodically we merge them in master. The problem is when two people need to add translations in their branches. Since compilemessages effectively changes the .po file, git cannot merge them and the second person have to manually resolve conflicts in the translations. We can't ignore .po files because translations are important to be in version control system. For now there are two possible ways to deal with the problem:

  1. To accumulate translations first and running compilemessages and makemessages only at certain times.

  2. To make translations only before merge and be sure to merge the PR with master before running compilemessages.

So there are two questions involved:

  1. How to manage Django translations in git?
  2. And the more general - how to manage machine generated files which should stay in version control?
Mariy
  • 5,746
  • 4
  • 40
  • 57
  • 2
    The most effective solution we've found so far is to only make and compile translations as the last step of our release process, ie in either a hotfix or release branch. – bruno desthuilliers Mar 17 '17 at 12:26
  • Does it *change* the .po file or completely *generate* the .po file? If the latter, why keep the .po file in the repository at all? You can easily regenerate them from the source, no? – Lasse V. Karlsen Mar 17 '17 at 12:44
  • You generate the file and add only the needed translations. But `compilemessages` generate new file while comparing it with the older version. All the current translations are kept in the `.po` file and `compilemessages` use them adding only the new ones and checking for fuzzy matches. – Mariy Mar 17 '17 at 12:51
  • 1
    http://stackoverflow.com/a/35442565/2303202 tl;dr: generate new version of the file during merge conflict resolution. – max630 Mar 18 '17 at 21:14

0 Answers0