Wiki › Project

Loc Translate

Article
From Chaipat's knowledge graph

Loc Translate is a free, open-source agent skill, written in Python, that translates locale files for game mods and apps into any language without breaking a single token. It is the translation step of his Localization Kit, which shares a glossary with Glossary Forge.

The problem

Game dialogue files are full of control codes: {{x}}, #$b#, $h, @, ^, %item … %%, {0} and markup tags. If a translator, human or AI, moves, drops or translates one of these, the game shows garbage or crashes.

How it works

  • Locks every token behind a numbered placeholder before translation. After translation it checks the placeholders' count and order and the dialogue structure before writing anything back. Lines that fail are rejected with the reason and sent back for another try.
  • Keeps the file intact: translator comments, key order, trailing commas and formatting all survive. New keys appear where the source has them.
  • Gives the agent context:
    • translator notes taken from comments;
    • speaker hints taken from keys;
    • glossary terms for each line;
    • a style guide for game dialogue, and notes for each language.
  • Reuses translations: identical strings already translated elsewhere are offered, or filled in automatically.
  • Builds a review page, l10n/review.html, with source and translation side by side and every token highlighted.
python3 scripts/loctx.py init --target th
python3 scripts/loctx.py prepare
python3 scripts/loctx.py apply
python3 scripts/loctx.py review

A real run

The README's example translates 16 lines of a character's story from GI Extra Locations – Redux into Thai, keeping his voice consistent (ฉัน/คุณ, without polite particles). It protected 28 tokens and rejected none.

See also