I built a localization pass that never lets an unreleased game script leave the laptop
说明与用途
locsmith 是一个本地工具,使用开放权重模型预翻译游戏字符串,验证占位符、标签、长度和词汇表使用,并标记需要人工审核的字符串,确保 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