Skip to content

Commit

Permalink
adds Make target "supported-languages" to list languages 100% transla…
Browse files Browse the repository at this point in the history
…ted in Weblate

Includes some jq magic adapted from <https://stackoverflow.com/a/42428341>.
  • Loading branch information
cfm committed Sep 2, 2021
1 parent 93842a0 commit ac06545
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ version:

LOCALE_DIR=securedrop_client/locale
POT=${LOCALE_DIR}/messages.pot
SUPPORTED_LOCALES_LIST=l10n.txt
VERSION=$(shell python -c "import securedrop_client; print(securedrop_client.__version__)")
WEBLATE_API=https://weblate.securedrop.org/api/
WEBLATE_COMPONENT=securedrop # FIXME: securedrop-client (once unmarked "restricted" in Weblate)

# Update POTs from translated strings in source code and merge into
# per-locale POs.
Expand Down Expand Up @@ -204,3 +207,14 @@ ${LOCALE_DIR}/%/LC_MESSAGES/messages.mo: ${LOCALE_DIR}/%/LC_MESSAGES/messages.po
@pybabel compile \
--directory ${LOCALE_DIR} \
--statistics

# List languages 100% translated in Weblate.
.PHONY: supported-languages
supported-languages:
@wlc \
--format json \
--url ${WEBLATE_API} \
list-translations \
| jq -r 'map(select(.component.slug == "${WEBLATE_COMPONENT}", .translated_percent == 100)) | map("* \(.language.name|tostring) (``\(.language.code|tostring)``)") | join("\n")' \
> ${SUPPORTED_LOCALES_LIST}
@git add ${SUPPORTED_LOCALES_LIST}
1 change: 1 addition & 0 deletions requirements/dev-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ semgrep==0.42.0
sip==4.19.8
typed-ast==1.4.1
vcrpy==4.0.2
wlc==1.12
15 changes: 15 additions & 0 deletions requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ appdirs==1.4.4 \
--hash=sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41 \
--hash=sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128
# via black
argcomplete==1.12.3 \
--hash=sha256:291f0beca7fd49ce285d2f10e4c1c77e9460cf823eef2de54df0c0fec88b0d81 \
--hash=sha256:2c7dbffd8c045ea534921e63b0be6fe65e88599990d8dc408ac8c542b72a5445
# via wlc
arrow==0.12.1 \
--hash=sha256:a558d3b7b6ce7ffc74206a86c147052de23d3d4ef0e17c210dd478c53575c4cd
# via -r requirements/requirements.in
Expand Down Expand Up @@ -120,6 +124,7 @@ importlib-metadata==4.6.3 \
--hash=sha256:0645585859e9a6689c523927a5032f2ba5919f1f7d0e84bd4533312320de1ff9 \
--hash=sha256:51c6635429c77cf1ae634c997ff9e53ca3438b495f10a55ba28594dd69764a8b
# via
# argcomplete
# jsonschema
# pluggy
# pytest
Expand Down Expand Up @@ -458,6 +463,7 @@ python-dateutil==2.7.5 \
# -r requirements/requirements.in
# alembic
# arrow
# wlc
python-editor==1.0.3 \
--hash=sha256:a3c066acee22a1c94f63938341d4fb374e3fdd69366ed6603d7b24bed1efc565
# via
Expand All @@ -475,6 +481,10 @@ pytz==2021.1 \
--hash=sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da \
--hash=sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798
# via babel
pyxdg==0.27 \
--hash=sha256:2d6701ab7c74bbab8caa6a95e0a0a129b1643cf6c298bf7c569adec06d0709a0 \
--hash=sha256:80bd93aae5ed82435f20462ea0208fb198d8eec262e831ee06ce9ddb6b91c5a5
# via wlc
pyyaml==5.4.1 \
--hash=sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf \
--hash=sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696 \
Expand Down Expand Up @@ -550,6 +560,7 @@ requests==2.22.0 \
# -r requirements/requirements.in
# securedrop-sdk
# semgrep
# wlc
ruamel.yaml.clib==0.2.6 \
--hash=sha256:0847201b767447fc33b9c235780d3aa90357d20dd6108b92be544427bea197dd \
--hash=sha256:1866cf2c284a03b9524a5cc00daca56d80057c5ce3cdc86a52020f4c720856f0 \
Expand Down Expand Up @@ -684,6 +695,10 @@ wcwidth==0.2.5 \
--hash=sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784 \
--hash=sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83
# via pytest
wlc==1.12 \
--hash=sha256:3912b4c3c6b71fe920ec633dff68cd40a95678241aaffb32b277f76670c78105 \
--hash=sha256:e0a046aec8c1bb199bec20bd73e5b9ea1668d19e72fb6d0349bf7b80032af958
# via -r requirements/dev-requirements.in
wrapt==1.12.1 \
--hash=sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7
# via vcrpy
Expand Down

0 comments on commit ac06545

Please sign in to comment.