diff --git a/.github/workflows/check-coverage.yml b/.github/workflows/check-coverage.yml index 89324d9a..32e0ab58 100644 --- a/.github/workflows/check-coverage.yml +++ b/.github/workflows/check-coverage.yml @@ -32,6 +32,8 @@ jobs: python -m pip install --upgrade build pip install .[versioning] doit version + pip install .[localize] + doit localize pip install . python -m build pip install .[test] diff --git a/.github/workflows/check-mo-freshness.yml b/.github/workflows/check-mo-freshness.yml deleted file mode 100644 index 53d46ebb..00000000 --- a/.github/workflows/check-mo-freshness.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Check .mo bundles are up to date - -on: - workflow_dispatch: - pull_request: - branches: - - development - - main - paths: - - 'tabcmd/locales/**/*.properties' - - 'tabcmd/locales/**/*.mo' - - 'bin/i18n/**' - - 'dodo.py' - - '.github/workflows/check-mo-freshness.yml' - -permissions: - contents: read - -jobs: - check-mo-freshness: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v7 - - - name: Set up Python - uses: actions/setup-python@v7 - with: - python-version: '3.12' - - - name: Install localization deps - run: | - python -m pip install --upgrade pip - pip install .[localize] - - - name: Regenerate .po and .mo bundles - run: python -m doit localize - - - name: Verify regenerated files match what is committed - id: verify - run: | - # .po files are globally gitignored, so only check .mo drift. - if ! git diff --exit-code -- 'tabcmd/locales/**/*.mo'; then - echo "" - echo "The committed .mo files are out of date with the .properties sources." - echo "Run 'python -m doit localize' locally and commit the regenerated files." - echo "The freshly-generated files are attached as a workflow artifact." - exit 1 - fi - - # If the verify step failed the regenerated files are still on disk. Uploading - # them makes it easy to download from the failed CI run and commit them. - - name: Upload regenerated .mo files on failure - if: failure() - uses: actions/upload-artifact@v4 - with: - name: regenerated-mo-files - path: tabcmd/locales/**/*.mo diff --git a/.github/workflows/generate-metadata.yml b/.github/workflows/generate-metadata.yml index 9372e807..4f255d8e 100644 --- a/.github/workflows/generate-metadata.yml +++ b/.github/workflows/generate-metadata.yml @@ -25,6 +25,8 @@ jobs: python -m pip install --upgrade build pip install .[versioning] doit version + pip install .[localize] + doit localize pip install . python -m build pip install .[test] diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 9413ed6a..03347932 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -74,6 +74,8 @@ jobs: python -m pip install --upgrade build pip install .[versioning] doit version + pip install .[localize] + doit localize pip install . python -m build pip install .[package] diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index ced79a7e..d99d7d24 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -29,6 +29,8 @@ jobs: python -m pip install --upgrade build pip install .[versioning] doit version + pip install .[localize] + doit localize pip install . python -m build diff --git a/.github/workflows/run-e2-tests.yml b/.github/workflows/run-e2-tests.yml index 3c2acffb..77b70eb4 100644 --- a/.github/workflows/run-e2-tests.yml +++ b/.github/workflows/run-e2-tests.yml @@ -91,6 +91,8 @@ jobs: python -m pip install --upgrade build pip install .[versioning] doit version + pip install .[localize] + doit localize pip install . python -m build pip install .[test] diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index dbebaffe..f0a3e61e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -34,6 +34,8 @@ jobs: python -m pip install --upgrade build pip install .[versioning] doit version + pip install .[localize] + doit localize pip install . python -m build pip install .[test] diff --git a/.gitignore b/.gitignore index 3e094da4..5f50f77f 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ test-output/ # localization intermediate files *.po tabcmd/locales/**/combined.tmp +tabcmd/locales/**/*.mo tabcmd/locales/codestrings.tmp # venv diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..22c8979a --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +# .mo bundles are generated by 'doit localize', not committed; the sdist must still carry them +recursive-include tabcmd/locales *.mo diff --git a/bin/i18n/README.md b/bin/i18n/README.md index 21e25eac..223692cf 100644 --- a/bin/i18n/README.md +++ b/bin/i18n/README.md @@ -10,6 +10,8 @@ Missing string keys are validated on every PR by `.github/workflows/check-string ## Regenerating .mo bundles +The .mo files are generated and are not committed. CI and packaging run `doit localize` before building. Run it locally after changing a .properties file or before running tabcmd from a checkout. + Run these when properties files change. Each step is idempotent and will overwrite the existing output. More details about implementation are in the script code at `dodo.py`. Or run the full pipeline in one command: diff --git a/contributing.md b/contributing.md index c67179c4..0e865e67 100644 --- a/contributing.md +++ b/contributing.md @@ -123,7 +123,7 @@ We have three levels of testing. Strings should be added/edited in /tabcmd/locales/en/{name}.properties by id and referred to in code as > string = _("string.id") -- regenerate updated strings for packaging as exe +- regenerate the (uncommitted) .mo bundles to see new strings locally; CI and packaging do this themselves > python -m doit properties po mo diff --git a/tabcmd/locales/de/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/de/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index 1e8df067..00000000 Binary files a/tabcmd/locales/de/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/en/LC_MESSAGES/.gitkeep b/tabcmd/locales/en/LC_MESSAGES/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/tabcmd/locales/en/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/en/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index bbfac751..00000000 Binary files a/tabcmd/locales/en/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/es/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/es/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index f0ec3524..00000000 Binary files a/tabcmd/locales/es/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/fr/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/fr/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index ebd31ac0..00000000 Binary files a/tabcmd/locales/fr/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/ga/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/ga/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index d6eb5def..00000000 Binary files a/tabcmd/locales/ga/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/it/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/it/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index 1443fa34..00000000 Binary files a/tabcmd/locales/it/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/ja/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/ja/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index 5e000352..00000000 Binary files a/tabcmd/locales/ja/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/ko/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/ko/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index 2a7894f0..00000000 Binary files a/tabcmd/locales/ko/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/pt/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/pt/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index 80804419..00000000 Binary files a/tabcmd/locales/pt/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/sv/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/sv/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index a8f6cf78..00000000 Binary files a/tabcmd/locales/sv/LC_MESSAGES/tabcmd.mo and /dev/null differ diff --git a/tabcmd/locales/zh/LC_MESSAGES/tabcmd.mo b/tabcmd/locales/zh/LC_MESSAGES/tabcmd.mo deleted file mode 100644 index ff3767c3..00000000 Binary files a/tabcmd/locales/zh/LC_MESSAGES/tabcmd.mo and /dev/null differ