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

Update translated strings #5790

Merged
merged 1 commit into from
Feb 16, 2021
Merged

Update translated strings #5790

merged 1 commit into from
Feb 16, 2021

Conversation

rmol
Copy link
Contributor

@rmol rmol commented Feb 14, 2021

Status

Ready for review

Description of Changes

Our current i18n release management workflow gets everything right on the securedrop-i18n/i18n branch, but doesn't ensure that the PO template is updated back on the develop branch. This PR brings securedrop/translations/messages.pot up to date. A documentation update is pending to reduce the chance of this happening in the future.

Testing

Put this in a script called ckpo.py:

#!/usr/bin/env python3

import sys

from babel.messages.catalog import Catalog
from babel.messages.pofile import read_po

from sdconfig import config


catalogs = {}
pofiles = sorted(config.TRANSLATION_DIRS.glob("**/messages.po"))
for po in pofiles:
    catalog = read_po(open(str(po)))
    catalogs[str(catalog.locale)] = catalog

pot = config.TRANSLATION_DIRS / "messages.pot"
srccat = read_po(open(str(pot)))
for message in srccat:
    if "fuzzy" in message.flags:
        continue
    for locale, catalog in catalogs.items():
        translation = catalog.get(message.id)
        if translation is None:
            print("message not present in {}: {}".format(catalog.locale, message.id), file=sys.stderr)
        elif not translation.string:
            print("message not translated in {}: {}".format(catalog.locale, message.id), file=sys.stderr)
  • git checkout develop
  • In the root of your securedrop working copy, run PYTHONPATH=securedrop /path/to/ckpo.py
    The output should contain four WARNING lines which you can ignore, and quite a few "message not present" errors. Those are strings which no longer exist in our code.
  • git checkout -b update-translation-messages origin/update-translation-messages
  • Run ckpo.py again. This time there should only be the four ignorable WARNING lines, and 13 icon alt text strings that have not been translated to Hindi, which is accurate. If this matches what you see, the messages.pot file now matches the translatable strings in our source.

Deployment

This doesn't affect the production message catalogs.

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

Our current i18n release management workflow gets everything right on
the securedrop-i18n/i18n branch, but doesn't ensure that the PO
template is updated back on the develop branch. This commit brings
securedrop/translations/messages.pot up to date. A documentation
update is pending to reduce the chance of this happening in the
future.
@rmol rmol added i18n Anything related to translation or internationalization of SecureDrop small off-sprint PR labels Feb 14, 2021
@codecov-io
Copy link

codecov-io commented Feb 15, 2021

Codecov Report

Merging #5790 (ad9b9f6) into develop (f4b7805) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5790   +/-   ##
========================================
  Coverage    85.68%   85.68%           
========================================
  Files           52       52           
  Lines         3834     3834           
  Branches       472      472           
========================================
  Hits          3285     3285           
  Misses         442      442           
  Partials       107      107           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4b7805...ad9b9f6. Read the comment docs.

@kushaldas kushaldas self-assigned this Feb 16, 2021
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.

This is good. @rmol I think we can make ckpo.py part of the developers' scripts. Will help in future too.

@kushaldas kushaldas merged commit f3e51b4 into develop Feb 16, 2021
@kushaldas kushaldas deleted the update-translation-messages branch February 16, 2021 07:04
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 small off-sprint PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants