I built a localization pass that never lets an unreleased game script leave the laptop
Описание и применение
locsmith — локальный инструмент, который переводит строки игры с помощью открытой модели Gemma 4, проверяет placeholders, теги, длину и глоссарий, и помечает строки, требующие ручного обзора, тем самым защищая NDA‑защищённый контент.
Задача
Unreleased game scripts cannot be sent to cloud APIs due to NDAs, and agency translation passes are costly; raw machine translation often breaks placeholders, tags, and UI length limits.
Результат
locsmith translated 13 strings (en→ru) in 200 s on a 16 GB M1, 11/13 passed validation, 2 flagged for review due to UI length overflows, no placeholders or tags were lost, and glossary terms were correctly inflected.
Рабочий процесс
- Batch strings with context and glossary hints
- Send batch to local model (Gemma 4 via Ollama)
- Validate placeholders, tags, line breaks, max_len, glossary terms
- If validation fails, retry with specific error prompt
- Mark unresolved strings as review
- Output CSV with status flags
- Use non‑zero exit code to gate CI
Доказательства
locsmith handles the boring 80% before a human translator sees the file: It batches strings to a local model with context hints and the glossary terms relevant to that batch.
It validates every result: placeholders and rich-text tags must match the source exactly (reordering is allowed), line breaks are preserved, per-string max_len is respected, and glossary terms are used.
One command against the bundled sample (13 strings, English → Russian, with a glossary): python3 locsmith.py samples/strings.csv --to ru -g samples/glossary.ru.csv translated 13/13 gemma4:12b @ http://localhost:11434/v1 strings: 13 ok: 11 needs review: 2 auto-fixed on retry: 0 cached: 0 time: 200.2s (15.40s per new string)
- Дата записи: 2026-10-14T22:41:17.508Z