I built a localization pass that never lets an unreleased game script leave the laptop
Description and use
locsmith is a local tool that pre‑translates game strings with an open‑weight model, validates placeholders, tags, length, and glossary usage, and flags strings needing human review, keeping NDA‑protected content on the developer’s machine.
Problem
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.
Outcome
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.
Workflow
- 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
Evidence
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)
- Record date: 2026-10-14T22:41:17.508Z