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

streamline functions currently provided by i18n_tool.py #6917

Closed
3 tasks done
Tracked by #6232
cfm opened this issue Aug 14, 2023 · 6 comments · Fixed by #6954
Closed
3 tasks done
Tracked by #6232

streamline functions currently provided by i18n_tool.py #6917

cfm opened this issue Aug 14, 2023 · 6 comments · Fixed by #6954
Assignees

Comments

@cfm
Copy link
Member

cfm commented Aug 14, 2023

@cfm cfm mentioned this issue Aug 14, 2023
11 tasks
@cfm cfm moved this to Ready to go in SecureDrop dev cycle Aug 14, 2023
@cfm cfm added this to the SecureDrop 2.7.0 milestone Aug 14, 2023
@zenmonkeykstop zenmonkeykstop moved this from Ready to go to Cycle Backlog in SecureDrop dev cycle Aug 14, 2023
@zenmonkeykstop zenmonkeykstop moved this from Cycle Backlog to Ready to go in SecureDrop dev cycle Aug 14, 2023
@cfm cfm moved this from Ready to go to In Progress in SecureDrop dev cycle Aug 17, 2023
@cfm
Copy link
Member Author

cfm commented Aug 18, 2023

The {check,extract}-strings targets are available in 6917-c10s-l10n as of 63be596, which is failing CI in lint as intended. Remaining i18n_tool.py invocations to replace next week:

(.venv) user@sd-dev:~/securedrop$ grep -R "i18n_tool.py" * | grep -Ev "^changelog.md:"
Makefile:	@echo "SUPPORTED_LOCALES = $$(if test -f /opt/venvs/securedrop-app-code/bin/python3; then ./securedrop/i18n_tool.py list-locales --python; else DOCKER_BUILD_VERBOSE=false $(DEVSHELL) ./i18n_tool.py list-locales --python; fi)" | sed 's/\r//' >> securedrop/config.py
Makefile:	@$(DEVSHELL) $(SDROOT)/securedrop/i18n_tool.py list-translators
Makefile:	@$(DEVSHELL) $(SDROOT)/securedrop/i18n_tool.py list-translators --all
securedrop/debian/translations.sh:/tmp/securedrop-app-code-i18n-ve/bin/python3 ./i18n_tool.py --verbose translate-messages --compile
securedrop/bin/translation-test:./i18n_tool.py translate-messages --compile
securedrop/bin/translation-test:SUPPORTED_LOCALES=$(./i18n_tool.py list-locales)
securedrop/bin/generate-docs-screenshots:./i18n_tool.py translate-messages --compile
securedrop/bin/dev-deps:    ./i18n_tool.py translate-messages --compile

@cfm
Copy link
Member Author

cfm commented Aug 23, 2023

#6917 (comment):

This has always had a bit of smell to me. I think it's the only place outside of packaging where we let a Make target in one repository read or write a file in another. Even though there's a --docs-repo-dir, I've only ever been able to use (e.g.) /home/user/securedrop/securedrop-docs to get Docker to play nicely with permissions and Git roots.

Since our goal here is to automate as much of this process as possible, rather than reimplement this particular step literally, I propose to do one of the following instead, from least to most effort:

  1. Replace the include directive in install.rst with a link to i18n.json.
  2. Add a Make target that writes i18n.json to either i18n.md or i18n.rst in this repository. Then replace the include directive in install.rst with a link to that file, which GitHub will render. Enforce this in CI, as make check-strings enforces make extract-strings.
  3. Add a Make target in securedrop-docs that fetches i18n.json and writes it to the l10n.txt expected by the include directive in install.rst. Use this in CI.

@legoktm
Copy link
Member

legoktm commented Aug 23, 2023

You have some stuff checked off in the above list, am I correct in assuming that's just a personal list you're using, i.e. those things haven't been fixed in develop yet nor a PR?

@cfm
Copy link
Member Author

cfm commented Aug 23, 2023

Yes, exactly, @legoktm: this checklist tracks the work in progress in i18n-6917-c10s-l10n.

@cfm
Copy link
Member Author

cfm commented Aug 23, 2023

@cfm
Copy link
Member Author

cfm commented Aug 24, 2023

Barring any objections to the reductions of scope I've proposed in #6917 (comment) and #6917 (comment), here's what's left here:

  1. export LOCALES="$(/usr/bin/python3 securedrop/i18n_tool.py list-locales --lines | circleci tests split | tr '\n' ' ')"
    invokes i18n_tool.py and needs to use make supported-locales instead, which means I need to factor out
    SUPPORTED_LOCALES=$(make --directory .. --quiet supported-locales | jq --raw-output 'join (" ")')
    to take a separator.
  2. There are also some tests (outside of the now-gone test_i18n_tool.py) that rely on i18n_tool.py and will need to use either pybabel or precompiled test fixtures instead.
  3. As we relearned in Add a GNOME Shell Extension #6712, the securedrop/desktop component is indeed unavoidable, because the Tails environment doesn't have gettext, pybabel, &c. available. Based on my findings just now in verify Weblate-compiled gettext machine objects in CI securedrop-client#1507 (comment), we can have Weblate generate .mo files for this component and verify them in CI, without needing to keep tooling around to update them manually.
  4. That will get us to the point of having a draft pull request, which we'll need to test (prior to formal review) in securedrop-i18n-sandbox against weblate-sandbox per adopt continuous localization #6232.

cfm added a commit to freedomofpress/securedrop-docs that referenced this issue Sep 28, 2023
The assumption here is that we are comfortable asking administrators to
read a JSON file.  See
<freedomofpress/securedrop#6917 (comment)>
for alternative approaches.
cfm added a commit to freedomofpress/securedrop-docs that referenced this issue Sep 28, 2023
The assumption here is that we are comfortable asking administrators to
read a JSON file.  See
<freedomofpress/securedrop#6917 (comment)>
for alternative approaches.
@cfm cfm moved this from In Progress to Ready For Review in SecureDrop dev cycle Sep 29, 2023
@nathandyer nathandyer moved this from Ready For Review to Under Review in SecureDrop dev cycle Oct 6, 2023
@cfm cfm closed this as completed in #6954 Oct 11, 2023
@github-project-automation github-project-automation bot moved this from Under Review to Done in SecureDrop dev cycle Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants