[CI] Ensure messages.pot stays updated #808
Open
+159
−34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new CI job to ensure that the
messages.pot
file is always up to date. It also adds apre-commit
hook that automatically runs theextract_messages
step before each commit.Pre-commit hook
The hook runs a Python script that does the following:
python3 setup.py extract_messages
.messages.pot
differs from the previous version, ignoring changes to the metadata fieldsPOT-Creation-Date
andGenerated-By
.Github Action
Similarly, the GitHub workflow runs the
pre-commit
hook. If it results in any changes, they will appear as a diff in the logs, and the action will fail. This makes it clear that the PR must be updated to include the corresponding changes tomessages.pot
.Other changes
setuptools
as a dependency inrequirements-l10n.txt
.messages.pot
since thedev
branch was not up to date.pre-commit
hook.I also considered adding
pre-commit
itself torequirements-l10n.txt
, but decided against it. It’s not strictly an l10n dependency. We may want to add arequirements-dev.txt
instead, or even better, migrate fully topyproject.toml
and/or a tool like uv.This pull request is categorized as a:
Checklist
pytest
and made sure all unit tests pass before submitting the PRIf you modified or added functionality/workflow, did you add new unit tests?
I have tested this PR on the following platforms/os: