-
-
Notifications
You must be signed in to change notification settings - Fork 2
en I18n_ci
.github/workflows/i18n.yml regenerates src/i18n/locales/auto/*.auto.json
from src/i18n/locales/en.ts on every change to the English source (or
the generator pipeline). Output lands as a PR — never committed direct
to main — so a human eyeballs machine-translation quality before it
ships.
-
Push to
mainthat touches any of:src/i18n/locales/en.tssrc/i18n/glossary.json-
scripts/generate_auto_locales.py,i18n_backends.py,i18n_plurals.py,i18n_config.py,i18n_export.mjs .github/workflows/i18n.yml
-
workflow_dispatch— manual trigger, optionaltargets=ru,plinput for narrow reruns. Release-time regeneration uses this path (tags don't trigger the workflow directly; see the YAML comment).
- Checkout + setup Python 3.11 (with pip cache) + Node 20 (npm cache).
-
Install Python deps —
argostranslate>=1.9andBabel>=2.14. Fullrequirements.txtis intentionally skipped here because it pulls torch / ctranslate2 / cuda which would blow out the CI disk. -
Install minimal Node deps —
npm ci --ignore-scriptsfortsx. -
Restore Argos package cache from
~/.local/share/argos-translate, keyed onhashFiles('scripts/i18n_config.py'). Adding / removing a language invalidates the cache cleanly. Cold start ~10 min (14 lang packs × ~30 MB each). Warm rerun ~2 min. -
Export
en.ts→ JSON vianpx tsx scripts/i18n_export.mjs en. -
Run the generator with
--backend argosover the exported JSON. -
Key-parity sanity check — every auto bundle must cover every
source key (modulo plural expansion which adds
_one/_few/etc.). Fails the job with::errorlines listing the first 5 missing keys per offending bundle. - Detect changes — skip PR creation if nothing actually diffed.
-
Create / update PR via
peter-evans/create-pull-request@v6on branchi18n/auto-update. PR body has a checklist for the reviewer.
You don't need the CI to regenerate locally — everything the workflow does is runnable on a dev machine:
# One-off regenerate all 14 auto-languages using the real Argos backend.
# Works only with Python 3.9+ where argostranslate installs cleanly.
pip install 'argostranslate>=1.9' 'Babel>=2.14'
npx tsx scripts/i18n_export.mjs en > /tmp/en.json
python scripts/generate_auto_locales.py \
--source /tmp/en.json \
--output src/i18n/locales/auto \
--backend argos
# Single-language regenerate (e.g. after fixing a glossary entry):
python scripts/generate_auto_locales.py \
--source /tmp/en.json \
--output src/i18n/locales/auto \
--targets ja \
--backend argos \
--force
# Dry-run (useful for pipeline debugging):
python scripts/generate_auto_locales.py --dry-runThe first real run downloads Argos language packs automatically — plan for ~10 min and ~500 MB of disk usage.
To regenerate only a subset via workflow_dispatch:
- Actions tab → "Auto-translate locales" → "Run workflow"
- Branch:
main -
targets: comma-separated codes, e.g.ru,pl,cs -
force:trueif the source hash hasn't changed but you still want a re-run (rare — usually only when fixing a generator bug).
Parity check failed — generator silently dropped some keys. Most
likely a placeholder like {{count}} got stripped by Argos. Fix by
adding the offending term / pattern to src/i18n/glossary.json and
rerunning.
Cache miss on warm run — check whether scripts/i18n_config.py was
touched. Every change to that file invalidates the cache intentionally.
PR not opening — check permissions: in the workflow. Needs
contents: write + pull-requests: write. GitHub occasionally tightens
defaults; if you see "resource not accessible by integration" errors,
re-read the workflow permissions block.
Short-term: comment out the on.push stanza and rely on
workflow_dispatch only. Long-term: delete the workflow file — locale
output is committed, so disabling CI doesn't break the SPA, it just
stops automatic regeneration.
🤖 This wiki is auto-synced from docs/ in the main repo. Hand-edits on the wiki UI get overwritten on the next push. Open a PR against the main repo instead.
MIT License · Sponsor · Ko-fi
SelenaCore
🇬🇧 English
Getting started
Architecture
Voice & translation
Hardware integration
Development
- Modules overview
- Module development
- System module development
- Module API guide
- Module bus protocol
- Widget development
- User manager / auth
Reference
🇺🇦 Українська
Початок
Архітектура
Голос і переклад
Інтеграція заліза
Розробка
- Розробка модулів
- Розробка системних модулів
- Module API
- Module bus
- Widget development
- User manager / auth
Довідник