Improve i18n_tool.py update-from-weblate #5863
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Status
Ready for review
Description of Changes
When committing changes to a .po file, the script assumed that it would always have committed the last change as part of the update-from-weblate task. If the file were changed outside of that workflow, and the commit message wasn't structured as expected, the script would be unable to gather translator credits correctly.
This changes the script to look past the last commit until it finds one of its commit messages.
Testing
git checkout -b credit-check aee4ffa6c
i18n_tool.py
from this branch:git checkout origin/fix-update-from-weblate-credits -- securedrop/i18n_tool.py
HEAD
to avoid that change being picked up by theupdate-from-weblate
task (just speeds things up):git reset HEAD
securedrop/bin/dev-shell ./i18n_tool.py --verbose update-from-weblate
git diff develop -- securedrop/translations
should report no changessecuredrop/bin/dev-shell ./i18n_tool.py list-translators --target 2e52ab4e0 --since 1.7.1
should match the lists of contributors per language in the commit messages shown bygit log aee4ffa6c..
securedrop/bin/dev-shell ./i18n_tool.py list-translators --all
should work, reporting many many contributorsDeployment
No production implications.
Checklist
If you made non-trivial code changes:
Choose one of the following: