Skip to content

Conversation

Chaitanya-Keyal
Copy link
Contributor

Description

This PR introduces a new CI job to ensure that the messages.pot file is always up to date. It also adds a pre-commit hook that automatically runs the extract_messages step before each commit.

Pre-commit hook

The hook runs a Python script that does the following:

  • Runs python3 setup.py extract_messages.
  • Checks if the updated messages.pot differs from the previous version, ignoring changes to the metadata fields POT-Creation-Date and Generated-By.
  • If there are meaningful changes, the hook ends with a "failed" status because it modified tracked files (this is expected). The developer can then review and commit the updated messages.pot.
  • If the only differences are in the ignored metadata fields, the file is reverted to its previous state, preventing unnecessary diffs.

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 to messages.pot.

Other changes

  • Added setuptools as a dependency in requirements-l10n.txt.
  • Updated messages.pot since the dev branch was not up to date.
  • Updated documentation with instructions for setting up the pre-commit hook.

I also considered adding pre-commit itself to requirements-l10n.txt, but decided against it. It’s not strictly an l10n dependency. We may want to add a requirements-dev.txt instead, or even better, migrate fully to pyproject.toml and/or a tool like uv.


This pull request is categorized as a:

  • Other

Checklist

  • I’ve run pytest and made sure all unit tests pass before submitting the PR

If you modified or added functionality/workflow, did you add new unit tests?

  • N/A

I have tested this PR on the following platforms/os:

  • Other

@newtonick
Copy link
Collaborator

LGTM, ACK and Tested locally and in my forked repo with some test PRs.

@newtonick newtonick added this to the 0.9.0 milestone Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants