Skip to content

Translations: Write a script for merging changes #690

@Infernio

Description

@Infernio

This is more involved than you'd think! Would be truly annoying, but we should be able to automate it near-fully:

  • Needs wlc installed and API keys set on the maintainer's machine
  • First, wlc lock so translators can't lose their work
  • git fetch to get the latest changes
  • Check out the weblate-out branch and git reset --hard to grab the changes
  • wlc commit and wlc push to send out all pending changes to weblate-out
  • git fetch to get the changes, keep trying that until we get new commits (since with our config, weblate will always rewrite commits and force-push them, this gives us a clear indicator of when weblate has pushed)
  • Once again, git reset --hard to grab the changes
  • Weblate always credits itself as commit author and gives the actual translators co-author credit, so we need to fix the commit author to give real credit
  • Use PyGithub to get each translator's avatar, update the general readme to credit translators
  • Give the maintainer a chance to clean up the branch now (maybe some auto-cleanup here, especially squashing all the automatic template.pot commits)
  • Once the maintainer signals they're ready to go, run the template updating script to finish off the branch
  • no-ff-merge the branch to dev, let the maintainer edit the merge commit message
  • Once done, switch over to weblate-in, git reset --hard dev
  • Force-push weblate-in first (before pushing dev, this is important! Otherwise the CI will run on the dev push and try to rebase all the old template.pot updates, which will conflict if they got squashed during the merge (which they probably were))
  • Push dev
  • wlc reset to make Weblate completely discard its state and grab a fresh copy from our repo (this is safe because we locked the repo and pulled all pending changes, so there's nothing lost here)
  • wlc unlock and done!

Note to self: it looks like step 6 is not correct, Weblate will not force-push with no changes (anymore?). So probably need to just try 5 times or so with a couple seconds wait time between, then assume no changes were pushed and move on.

Metadata

Metadata

Assignees

Labels

A-l10nArea: Localization (localize.py and the l10n folder)C-todoCategory: TODO, specific item that needs to be accomplished in working towards a goal

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions