Keeping translations updated

It was suggested in the 2024-05-11 meeting that one way we could keep translations (currently just the website) updated is to have a list of translators to ping. That can get us started, but I’d also like to gather some ideas on solutions for the translators.

(For those unaware, this is how translations are done right now; we currently have Danish and German in production, with three other locales having open PRs)

Initially, we just needed to copy the English JSON and start editing. Now that the master files is starting to diverge from the locales, what are some ways we can most easily work on translating newer keys when working on updates? The version key is a good start, but we could include a page possibly in the wiki on a set of commands or tooling that will “update this locale to the latest, pulling new keys as English and keeping existing translated phrases”.

Here’s one idea from me, using git merge conflicts.

Consider locale x, after a git pull:

  • locales/x/ Contains existing keys, for which values are translated into X
  • locales/en/ Contains existing keys and new keys, all of which in English

For minor changes to the /locales/en/ JSON, this could work:

  1. Start with a clean state
  2. Reset to before the last commit that changed locales/en/
  3. cp locales/x/translations.json locales/en/translations.json then format a patch: git diff -p --stat > x.patch
  4. git pull
  5. git am -3 < x.patch
  6. Resolve conflicts from your editor (git rerere might also be useful here)

An alternative to this would be cherry-picking.

However, none of this works right now for the current case or updates of a similar kind in the future because changes are rather substantial and also involve formatting. The entire file is marked as a conflict, which brings us back to square one.

For now, translation.json is of a manageable size to merge by-hand (which I’ll probably be doing for my translation PR), but I’d like to know if people have ideas on better, more generalized solutions.

Maybe making use of the new version key, make a script to actually parse the JSON and then merge? (This might be prone to not picking up the English version updated under the same key.)

Or we could have an actual system in place for translating rather than editing JSON? For instance, @minion suggested Weblate:

Do note though, that before we can decide on which to use and have it set up, the updated frontpage remains in need of updates as soon as possible.