Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve i18n_tool.py update-from-weblate #5863

Merged
merged 1 commit into from
Apr 21, 2021

Conversation

rmol
Copy link
Contributor

@rmol rmol commented Mar 11, 2021

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

  • Create a branch to replicate the merge of translations for 1.8.0: git checkout -b credit-check aee4ffa6c
  • Check out i18n_tool.py from this branch: git checkout origin/fix-update-from-weblate-credits -- securedrop/i18n_tool.py
  • Reset to HEAD to avoid that change being picked up by the update-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 changes
  • securedrop/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 by git log aee4ffa6c..
  • securedrop/bin/dev-shell ./i18n_tool.py list-translators --all should work, reporting many many contributors

Deployment

No production implications.

Checklist

If you made non-trivial code changes:

  • I have written a test plan and validated it for this PR

Choose one of the following:

  • I have opened a PR in the docs repo for these changes, or will do so later
  • I would appreciate help with the documentation
  • These changes do not require documentation

@rmol rmol added i18n Anything related to translation or internationalization of SecureDrop small off-sprint PR labels Mar 11, 2021
@rmol rmol added this to the 1.9.0 milestone Mar 11, 2021
@rmol rmol self-assigned this Mar 11, 2021
@rmol rmol marked this pull request as draft March 22, 2021 16:08
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.
@rmol rmol force-pushed the fix-update-from-weblate-credits branch from 7aa1302 to 12149f9 Compare March 31, 2021 21:32
@rmol rmol marked this pull request as ready for review April 1, 2021 12:53
Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During the test steps, all looked okay. But, git diff develop -- securedrop/translations showed me the difference between the branches. I think that is what it should show, but @rmol said it should not.

I will defer the approve part till we have a quick chat about it, but, otherwise the PR is great.

@rmol
Copy link
Contributor Author

rmol commented Apr 20, 2021

Ah, the translations have changed on develop since I wrote the test plan, and I should have asked you to compare to 1.8.0 in the first place. Use git diff 1.8.0 -- securedrop/translations instead of git diff develop -- securedrop/translations, and you should see no differences reported.

Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Will have a chat with @rmol before merging.

@rmol
Copy link
Contributor Author

rmol commented Apr 21, 2021

Merging per discussion in standup.

@rmol rmol merged commit 826c178 into develop Apr 21, 2021
@rmol rmol deleted the fix-update-from-weblate-credits branch April 21, 2021 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n Anything related to translation or internationalization of SecureDrop
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants