Stop committing generated .mo (and .po) files; generate them at build time
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- python
- Ambito
- build-system, cli, localization
Direzione di ricerca
Start by reading pyproject.toml, the existing doit localize task, the check-mo-freshness workflow, and the PyInstaller spec files. Verify how packaging currently includes locale data before choosing the build hook. Done means .mo files are generated during package builds, excluded from git, bundled correctly by PyInstaller, and the obsolete freshness workflow is removed.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The tabcmd/locales/*/LC_MESSAGES/tabcmd.mo files are checked into git today, and .po files are gitignored but still regenerated locally when someone runs doit localize. This has two problems:
-
Drift. The committed
.mofiles can - and do - go out of sync with the.propertiessources they are built from. Before #440 landed, a freshdoit localizeagainst the tip ofdevelopmentregenerated all 11 locale.mofiles with ~20 keys different from what was committed (mostly stale entries for old keys and missing entries for new keys added since the last regen). Users hitting the drifted keys would see stale translations or fall back to the raw key. -
Reviewer noise.
.modiffs are binary and unreadable in PRs. Reviewers cannot see whether a.mochange matches its intended.propertieschange.
The check-mo-freshness workflow added in #440 catches drift at PR time by regenerating and diffing. That closes the immediate leak but keeps the underlying pattern of "generated file committed to git."
Better long-term: treat .mo (and if practical .po) like tabcmd/_version.py - generate them during pip install / packaging, .gitignore them, and stop tracking them. pyproject.toml can wire the generation into the build backend so wheels and pyinstaller bundles include them. Contributors then only edit .properties; no regenerate-and-commit dance, no drift possible.
Prior art: most Python i18n projects (Babel, Django, Flask-Babel) treat .mo as build output.
Rough plan
- Add a build step that runs
doit localize(or the equivalentmsgfmtinvocations) atpip install/ wheel build time. - Verify pyinstaller still bundles the generated
.mofiles correctly (via--collect-data tabcmd.localeswhich is already in the spec files). .gitignore**/*.mo;git rm --cachedthe tracked ones.- Remove the
check-mo-freshnessworkflow (it becomes moot once nothing is committed to drift from).
- Lingua principale
- Python
- Stelle
- 52
- Fork
- 17
- Merge medio
- 5g 20h
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tableau/tabcmd
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
feat: publish missing --description flag from tabcmd ClassicForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
feat: creategroup missing --role flag from tabcmd ClassicForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Tutte le issue di tableau/tabcmd
Issue simili
-
documentation pkg: sphinx-needs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
useblocks/sphinx-needs#2255 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
home-assistant/core#186538 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
btclib-org/btclib-secp256k1#1181 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pyrite-wiki/pyrite#917 ·
I maintainer di solito rispondono entro 1 giorno