From 11450afa810f59837519e919a13f399b8d9ef9a9 Mon Sep 17 00:00:00 2001 From: Anthony Bilinski Date: Fri, 18 Feb 2022 12:44:20 -0800 Subject: [PATCH] feat(i18n): Check for new translatable strings on every PR We've only been updating translatable strings for Weblate rarely based on MAINTAINING.md#translations-from-weblate. Since Weblate pulls in commits live from qTox, we should generate the translatable strings as soon as they're introduced so that translators can not waste time translating deleted strings, and can spend time translating new strings. We can't auto-commit the changes in CI due to our requirement of signed commits, so just fail CI if any new strings are found. Move it into its own job, it doesn't depend on docker or the build, and doesn't need to run for debug/release/full/minimal --- .github/workflows/build-test-deploy.yaml | 9 +++++++++ MAINTAINING.md | 9 ++++----- tools/update-translation-files.sh | 4 ---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-test-deploy.yaml b/.github/workflows/build-test-deploy.yaml index c4532c382..c3fceb466 100644 --- a/.github/workflows/build-test-deploy.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -172,6 +172,15 @@ jobs: docker_image_name: debian_old - name: Run build run: docker-compose run --rm debian_old ./.ci-scripts/build-qtox-linux.sh --build-type ${{ matrix.build_type }} --${{ matrix.features }} + translation-check: + name: Check for translatable strings + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install deps + run: sudo apt-get update && sudo apt-get install qttools5-dev + - name: Test for modified translatable strings + run: ./tools/update-translation-files.sh ALL && git diff --exit-code build-ubuntu: name: Ubuntu LTS runs-on: ubuntu-latest diff --git a/MAINTAINING.md b/MAINTAINING.md index 4788212e5..1a267a888 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -161,6 +161,9 @@ require a bit more attention & regular checking whether there are new translations, on the other, it lessened problems that were happening with "manual" way of providing translations. +New translable strings need to be generated into a form Weblate can consume +using `./tools/update-translation-files.sh ALL` and commiting the result. + To get translations into qTox: 1. Go to `https://hosted.weblate.org/projects/tox/qtox/#repository` and lock @@ -174,11 +177,7 @@ To get translations into qTox: - `translations/README.md` - `translations/i18n.pri` - `translations/translations.qrc` -5. To update translatable strings from qTox for Weblate, run - `./tools/update-translation-files.sh ALL` -6. Checkout a new branch with e.g. `git checkout -b update_weblate` and open - a Pull Request for it on Github. -7. After the Pull Request has been merged, `reset` Weblate to master and +5. After the Pull Request has been merged, `reset` Weblate to master and unlock it. # Releases diff --git a/tools/update-translation-files.sh b/tools/update-translation-files.sh index edcebf92a..d23fa9614 100755 --- a/tools/update-translation-files.sh +++ b/tools/update-translation-files.sh @@ -27,7 +27,6 @@ set -eu -o pipefail -readonly COMMIT_MSG="chore(i18n): update translation files for Weblate" readonly LUPDATE_CMD="lupdate src -no-obsolete -locations none -ts" if [[ "$@" = "ALL" ]] @@ -36,9 +35,6 @@ then do $LUPDATE_CMD "$translation" done - - git add translations/*.ts - git commit -m "$COMMIT_MSG" else $LUPDATE_CMD "$@" fi