Add translation CI validation#4519
Open
Softer wants to merge 3 commits intoarchlinux:masterfrom
Open
Conversation
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.
Contributor
Author
|
I summon @svartkanin for discussion :-) |
Align check_pot_freshness.py and pot_tools.py with project indentation (tabs) and ruff format requirements. Sorry :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix broken localization in
global_menu.py:505:tr(f'Invalid configuration: {error}')evaluates the f-string beforetr()runs, so the translation catalog never matches. Switched totr('...{}').format(...)and updated the msgid inbase.pot.Add
scripts/pot_tools.pydeveloper utility:stats,list,add_missing [--dry-run]for managingbase.pot.Add
translation-checkCI workflow with two jobs:msgfmt --checkon changed.pofiles,.mosync warning. On .py changes: grep fortr(f"...")anti-pattern.tr()strings exist inbase.pot..py/.po/.potfile 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
.povalidation from.potfreshness checks.