From 53673632df122f38c99efb4e9aac4a15a8591244 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 24 Feb 2023 13:38:21 +0100 Subject: [PATCH] ci: check if locale are up to date --- .github/workflows/project.yml | 6 ++++++ .pre-commit-config.yaml | 9 +++++++++ legacy/locale/Makefile | 9 +++++++++ 3 files changed, 24 insertions(+) diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 8f7f7bc97..c057e7e23 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -15,6 +15,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + + - name: Install dependencies + run: | + DEBIAN_FRONTEND=noninteractive sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get install -y gettext + - uses: actions/setup-python@v4 with: python-version: "3.x" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0cbb2afcf..dd1f30a45 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -104,3 +104,12 @@ repos: pass_filenames: false language: script files: ^legacy + + - id: legacy-locale-update + name: legacy-locale-update + description: Update legacy locale + entry: make + args: [-C, legacy/locale, check-update] + pass_filenames: false + language: system + files: ^legacy diff --git a/legacy/locale/Makefile b/legacy/locale/Makefile index 13a33033d..fbd0ac9a2 100644 --- a/legacy/locale/Makefile +++ b/legacy/locale/Makefile @@ -32,6 +32,15 @@ update: find ./locale -name $(PO_FILE) -exec msgmerge $(MSGMERGE_ARGS) "{}" $(PO_FILE) \; rm $(PO_FILE) +update-foreach-commit: + git rebase main -x "$(MAKE) -C legacy/locale update" + +check-update: update + if git status --porcelain -- */LC_MESSAGES/$(PO_FILE) | grep -q '^ M'; then \ + git --no-pager diff -- */LC_MESSAGES/$(PO_FILE); \ + exit 1; \ + fi + %.mo: %.po msgfmt $< -o $@