Translation tools
A small, dependency-free Python utility for inspecting, comparing, extracting, and safely repacking locale archives.
locale_tools.py
The tool lives in .tools/translation-tools/locale_tools.py. Python 3.10 or newer is recommended.
Inspect archives
python3 .tools/translation-tools/locale_tools.py inspect \ English/SimCityLocale.dat Italian/SimCityLocale.dat
Compare a language with English
python3 .tools/translation-tools/locale_tools.py compare \ English/SimCityLocale.dat Italian/SimCityLocale.dat
Extract readable text
python3 .tools/translation-tools/locale_tools.py extract \ Italian/SimCityLocale.dat /tmp/italian.json
Safety checks
- Resources are identified by Type/Group/Instance (TGI) identifiers.
- Only exact, verified text matches are considered for conservative updates.
- HTML, escape sequences, placeholders, names, URLs, and technical tokens are preserved.
- LTEXT length fields, payload sizes, and DBPF offsets are rebuilt together.
- Trailing data, gaps, and overlapping payloads are rejected before repacking.
- The output is reopened and every LTEXT resource is decoded during validation.
Validation: every release runs a full DBPF integrity pass over all 13 locale archives before publishing.