From 7dfdfcfb7181e94d782dda85831982f51e70d078 Mon Sep 17 00:00:00 2001 From: Nicolas Peugnet Date: Tue, 28 May 2024 15:02:10 +0200 Subject: [PATCH 1/5] Add locale check script + CI job, that runs gettext check --- .github/workflows/lint.yml | 12 ++++++++++++ Makefile | 6 +++++- sphinx/locale/Makefile | 11 +++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 sphinx/locale/Makefile diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1c496947fe4..aacdc284b03 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -71,6 +71,18 @@ jobs: - name: Type check with mypy run: mypy + locale-check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3" + - name: Check locale files with gettext + run: make locale-check + docs-lint: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 54dd66dc888..a749a3492cf 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PYTHON ?= python3 all: format style-check type-check doclinter test .PHONY: check -check: style-check type-check doclinter +check: style-check type-check locale-check doclinter .PHONY: clean clean: clean @@ -56,6 +56,10 @@ format: type-check: @mypy +.PHONY: locale-check +locale-check: + @$(MAKE) -C sphinx/locale check + .PHONY: doclinter doclinter: @sphinx-lint --enable all --disable triple-backticks --max-line-length 85 --sort-by filename,line \ diff --git a/sphinx/locale/Makefile b/sphinx/locale/Makefile new file mode 100644 index 00000000000..b619990b22f --- /dev/null +++ b/sphinx/locale/Makefile @@ -0,0 +1,11 @@ +IGNORED = ta +LOCALES = $(filter-out $(IGNORED),$(patsubst %/LC_MESSAGES,%,$(wildcard */LC_MESSAGES))) +POFILES = $(LOCALES:%=%/LC_MESSAGES/sphinx.po) +CHECK = $(POFILES:.po=.check) + +.PHONY: all +check: $(CHECK) + +.PHONY: $(CHECK) +$(CHECK): %.check: %.po + msgfmt --check -o /dev/null $< From 089ab525c43c623e456e8c141f0b26d0906a90ee Mon Sep 17 00:00:00 2001 From: Nicolas Peugnet Date: Tue, 28 May 2024 15:09:07 +0200 Subject: [PATCH 2/5] Install gettext in CI --- .github/workflows/lint.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index aacdc284b03..682b5299544 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -80,6 +80,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3" + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install gettext - name: Check locale files with gettext run: make locale-check From e10b0d4d4608617b02ce4626883a855e775632ed Mon Sep 17 00:00:00 2001 From: Nicolas Peugnet Date: Wed, 29 May 2024 13:54:40 +0200 Subject: [PATCH 3/5] Python is not needed for locale-check --- .github/workflows/lint.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 682b5299544..da4dc233c8e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -76,10 +76,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3" - name: Install dependencies run: | sudo apt-get update From eae3a9de14514e70a2bfd0b21a138cd71b2466a5 Mon Sep 17 00:00:00 2001 From: Nicolas Peugnet Date: Sun, 2 Jun 2024 17:23:07 +0200 Subject: [PATCH 4/5] Allow to check ignored locales + add comment about them --- sphinx/locale/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx/locale/Makefile b/sphinx/locale/Makefile index b619990b22f..d7e754730a1 100644 --- a/sphinx/locale/Makefile +++ b/sphinx/locale/Makefile @@ -1,10 +1,10 @@ +# Ignore locales that are known failures. See utils/babel_runner.py IGNORED = ta -LOCALES = $(filter-out $(IGNORED),$(patsubst %/LC_MESSAGES,%,$(wildcard */LC_MESSAGES))) -POFILES = $(LOCALES:%=%/LC_MESSAGES/sphinx.po) +POFILES = $(wildcard */LC_MESSAGES/sphinx.po) CHECK = $(POFILES:.po=.check) .PHONY: all -check: $(CHECK) +check: $(filter-out $(IGNORED:=/LC_MESSAGES/sphinx.check),$(CHECK)) .PHONY: $(CHECK) $(CHECK): %.check: %.po From 380e6093bf5b67586389b0128b75d71824d876ce Mon Sep 17 00:00:00 2001 From: Nicolas Peugnet Date: Tue, 4 Jun 2024 11:35:28 +0200 Subject: [PATCH 5/5] fix phony target name --- sphinx/locale/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/locale/Makefile b/sphinx/locale/Makefile index d7e754730a1..e158343fc5c 100644 --- a/sphinx/locale/Makefile +++ b/sphinx/locale/Makefile @@ -3,7 +3,7 @@ IGNORED = ta POFILES = $(wildcard */LC_MESSAGES/sphinx.po) CHECK = $(POFILES:.po=.check) -.PHONY: all +.PHONY: check check: $(filter-out $(IGNORED:=/LC_MESSAGES/sphinx.check),$(CHECK)) .PHONY: $(CHECK)