Skip to content

Add translation CI validation#4519

Open
Softer wants to merge 3 commits intoarchlinux:masterfrom
Softer:feat-translation-ci
Open

Add translation CI validation#4519
Softer wants to merge 3 commits intoarchlinux:masterfrom
Softer:feat-translation-ci

Conversation

@Softer
Copy link
Copy Markdown
Contributor

@Softer Softer commented May 4, 2026

Fix broken localization in global_menu.py:505: tr(f'Invalid configuration: {error}') evaluates the f-string before tr() runs, so the translation catalog never matches. Switched to tr('...{}').format(...) and updated the msgid in base.pot.

Add scripts/pot_tools.py developer utility: stats, list, add_missing [--dry-run] for managing base.pot.

Add translation-check CI workflow with two jobs:

  • validate-po (on .po changes): msgfmt --check on changed .po files, .mo sync warning. On .py changes: grep for tr(f"...") anti-pattern.
  • validate-pot (on .py changes): verify all tr() strings exist in base.pot.
  • Workflow triggers only on .py/.po/.pot file changes — no unnecessary runs.

Context

The previous translation-check workflow (added 2023, removed in #4483) failed because it validated all 35 languages on every PR, causing merge conflicts between translators. This new workflow checks only changed files and separates .po validation from .pot freshness checks.

Softer added 2 commits May 4, 2026 23:26
tr(f'Invalid configuration: {error}') evaluates the f-string before
tr() runs, so xgettext extracts the literal placeholder as the msgid
while runtime passes the formatted string - the two never match.
Switch to tr('...{}').format(...) and update msgid in base.pot.
Add translation-check workflow with two jobs:
- validate-po: msgfmt --check on changed .po files, .mo sync warning,
  tr(f-string) anti-pattern grep on changed .py files
- validate-pot: verify all tr() strings exist in base.pot when .py
  files change

Workflow only triggers on .py/.po/.pot file changes.

Add scripts/pot_tools.py developer utility (stats, list, add_missing)
for managing base.pot.
@Softer Softer requested a review from Torxed as a code owner May 4, 2026 20:30
@Softer
Copy link
Copy Markdown
Contributor Author

Softer commented May 4, 2026

I summon @svartkanin for discussion :-)

Align check_pot_freshness.py and pot_tools.py with project
indentation (tabs) and ruff format requirements.

Sorry :-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant