Universal, layout-safe translation plumbing so AI coding agents translate documents, apps, websites, and games across any language on earth without ever overwriting source files.
tlate pairs an agentskills.io-compliant Agent Skill (skills/tlate/SKILL.md) and single-source agent ruleset (AGENTS.md) with a zero-dependency Python CLI (tlate). Your AI agent (Codex, Claude Code, Cursor, Antigravity, GitHub Copilot) focuses solely on linguistic quality and character voice while deterministic Python handles parsing, hybrid OCR, tag/placeholder protection, project sync, adaptive layout, visual comparison, and Smart QA. tlate performs no LLM API calls inside the CLI; translation quality depends on your AI agent's model and human review.
Quick Start · Supported Formats · Usage Guides · Agent Prompts · CLI Reference · Honest Limitations · Documentation
| Problem when AI agents translate directly | How tlate solves it |
|---|---|
| Agents write fragile one-off parsing scripts every session, breaking code, tags, or syntax. | The model only translates segment text; 30+ built-in deterministic handlers (plus tlate.formats plugins) handle parsing, tag masking (⟦P1⟧), and byte-safe reconstruction. |
| Source files or previous translations get overwritten. | Every write uses exclusive creation (open(..., "xb")) in a fresh tlate-output/<name>_<LANG>_<timestamp>/ folder with single-file or multi-file SHA-256 verification (tlate verify). |
Placeholders ({0:N2}, %1$s), RPG Maker codes (\C[1], \N[1]), BBCode/Ren'Py/Unity tags, URLs, or Excel formulas break. |
Game, web, markup, printf, and C#/Unity tags are masked before translation (⟦P1⟧, ⟦S1⟧…⟦/S1⟧) and strictly validated before any output file is written. |
| Tone and character voice drift across long chapters or multi-file repositories. | Voice Bible (voice-bible.md) + work/stable-prefix.md locking, per-batch speaker injection, Adaptive 2-Pass Polish, and shared multi-file TM keep voice consistent across hundreds of files. |
| App/game updates overwrite old work or force full re-translation. | Incremental Patch Sync (tlate sync / --existing-target + --previous-source) seeds unchanged translations and isolates only new or modified segments. |
| Encrypted or DRM-protected inputs are mishandled. | Password-protected PDFs, OLE/RMS Office files, encrypted ZIPs, and DRM EPUBs are refused upfront (exit 4, even without extras); signed and edit-restricted inputs require explicit consent (--allow-signed, --allow-edit-restricted). |
| Scanned PDFs fail extraction or force copyleft PDF dependencies everywhere. | tlate ocr uses permissive pypdfium2 + pluggable OcrEngine ([ocr] via tesserocr or system tesseract CLI) for per-page text_layer / ocr / mixed routing; PyMuPDF ([pdf]) remains strictly optional. |
# Core CLI (Python >= 3.12; zero mandatory third-party dependencies)
pip install tlate
# Optional extras as needed:
pip install "tlate[office,yaml,compare]" # DOCX/PPTX/XLSX (lxml), YAML, PNG visual comparison
pip install "tlate[ocr]" # Hybrid OCR (pypdfium2 + Pillow + tesserocr>=2.13.0 MIT + local tessdata Apache-2.0)
pip install "tlate[pdf]" # Optional PyMuPDF PDF rewrite backend (AGPL-3.0 / Artifex commercial)See Getting Started for local editable installs and tessdata setup.
tlate setup ./my-translationsPlace source files or project folders inside ./my-translations/documents/, open ./my-translations in your AI coding agent (AGENTS.md, CLAUDE.md, GEMINI.md, .cursor/rules/tlate.mdc, .github/copilot-instructions.md), and use one of the prompts in Copy-Paste AI Agent Prompts.
All core formats below require zero third-party dependencies unless noted under Optional Extra:
| Category | Format | Extensions / Files | Notes & Docs |
|---|---|---|---|
| Documents & Books | Markdown & MDX | .md, .markdown, .mdx |
Preserves code fences, tables, JSX/imports; opt-in YAML frontmatter via tlate.toml (markdown-text.md) |
| Plain text & E-books | .txt, .html, .htm, .xhtml, .epub |
BOM/CRLF, non-UTF-8 encodings, uncompressed EPUB mimetype, sets dir="rtl" (html-epub.md) |
|
Office OOXML ([office]) |
.docx, .pptx, .xlsx |
Direct XML editing (w:lang, w:bidi), formulas untouched, OLE refused (office.md) |
|
| PDF (text & scanned OCR) | .pdf |
Adaptive role-harmonized layout ([pdf]), bookmarks, hybrid tlate ocr ([ocr]) (pdf.md, ocr.md) |
|
| App & Mobile i18n | JSON & Flutter ARB | .json, .arb |
Nested keys, include_keys/exclude_keys, ICU plurals, @@locale (i18n.md) |
YAML ([yaml]) |
.yaml, .yml |
In-place edits preserving comments and structure (i18n.md) | |
| Gettext & Android XML | .po, .pot, strings.xml |
msgctxt, CLDR Plural-Forms, Android escapes (\'), <plurals> (i18n.md) |
|
| Apple Localization | .strings, .xcstrings |
Cocoa strings with C comments; Xcode String Catalog plural variations (web-and-config.md) | |
| XLIFF & .NET RESX | .xliff, .xlf, .resx |
XLIFF 1.2 & 2.0 <source>/<target>, RESX <data> with <comment> (web-and-config.md) |
|
| Web, Tables & Config | Web JSONC & JS/TS locales | .jsonc, .json5, .js, .ts, .mjs, .cjs |
Comment-preserving JSON5/JSONC; export default / module.exports objects (web-and-config.md) |
| CSV & TSV | .csv, .tsv |
Auto/config columns (key, source, target, speaker, context, max_chars) (web-and-config.md) |
|
| Properties & Config | .properties, .ini, .cfg, .toml |
\uXXXX Java properties, section/comment-preserving .ini/.cfg/.toml (web-and-config.md) |
|
| Games & Subtitles | Subtitles | .srt, .vtt, .ass, .ssa |
CJK/Latin reading speed & line limits; ASS {\pos}/\N & actor speaker preservation (subtitles.md, games.md) |
| Visual Novels & RPGs | Ren'Py .rpy, RPG Maker MV/MZ JSON |
Extracts dialogue/choices/actors (style.speaker), RPG codes 401/102/405 & \C[1] (games.md) |
|
| Narrative & Scripting | .lua, .yarn, .ink, custom tlate.toml scripts |
Lua tables, Yarn/Ink speaker dialogue/choices, declarative line_regex script rules (games.md) |
|
| Third-Party Plugins | Entry-point extensions | Any extension registered via tlate.formats |
Custom FormatHandler packages discovered automatically (project-mode.md) |
Actual tlate compare output on a synthetic PDF fixture (preserving colored callout boxes, raster images, {app_name} placeholders, and URLs):
Multi-Language Support (
--from auto, required--to): Ships24built-in language packs underlanguages/(checked viatlate lang check) plus universal generic BCP-47 fallback (skills/tlate/references/style-guides/default.md) for any unlisted or regional language (e.g.,sv-SE,jv,ks-Arab).
--to <lang> is required (no default target language); --from defaults to auto:
tlate init documents/guide.md --from en --to ja
tlate inspect documents/guide.md --to ja --json tlate-output/guide_JA_<timestamp>/reports/inventory.json
tlate extract documents/guide.md --result tlate-output/guide_JA_<timestamp>
# Or for scanned / mixed PDFs:
tlate ocr documents/scan.pdf --result tlate-output/scan_ID_<timestamp> --overlays
tlate glossary-scan tlate-output/guide_JA_<timestamp>/work/segments.jsonl --from en --to ja
tlate pilot tlate-output/guide_JA_<timestamp>/work/segments.jsonl --count 10
tlate batch tlate-output/guide_JA_<timestamp>/work/segments.jsonl --max-tokens 1500 \
--glossary tlate-output/guide_JA_<timestamp>/glossary.md \
--voice-bible tlate-output/guide_JA_<timestamp>/voice-bible.md --wire-format compact
# After writing translations to work/translations/*.jsonl:
tlate apply --result tlate-output/guide_JA_<timestamp>
tlate qa documents/guide.md tlate-output/guide_JA_<timestamp>/output/guide_JA.md \
--result tlate-output/guide_JA_<timestamp> \
--report tlate-output/guide_JA_<timestamp>/reports/QA_report.md \
--review-csv tlate-output/guide_JA_<timestamp>/reports/review_sheet.csv
tlate verify tlate-output/guide_JA_<timestamp>Translate an entire app, web repository, or RPG data/ folder under one shared glossary.md, voice-bible.md, and translation memory (work/tm.jsonl), mirroring the relative directory layout into output/ without ever modifying sources:
tlate init ./locales_src --from en --to id --profile web
tlate extract ./locales_src --result tlate-output/locales_src_ID_<timestamp>
tlate batch tlate-output/locales_src_ID_<timestamp>/work/segments.jsonl --wire-format compact
tlate apply --result tlate-output/locales_src_ID_<timestamp>
tlate qa --result tlate-output/locales_src_ID_<timestamp>
tlate verify tlate-output/locales_src_ID_<timestamp>See Project Mode & tlate.toml.
When upstream strings update (v1 -> v2), preserve existing reviewed translations and translate only new or changed lines:
# Option A: seed directly during extract
tlate init ./game_v2 --from ja --to en --profile rpgmaker
tlate extract ./game_v2 --result tlate-output/game_v2_EN_<timestamp> \
--existing-target ./game_en_v1 --previous-source ./game_v1
# Option B: run sync after extract
tlate sync ./game_v2 --result tlate-output/game_v2_EN_<timestamp> \
--existing-target ./game_en_v1 --previous-source ./game_v1- Separated (default): Store terminology + forbidden translations in
<result>/glossary.mdand style/register, speaker character cards, and linguistic briefs in<result>/voice-bible.md.tlate batchandtlate qaauto-detectvoice-bible.mdbesideglossary.mdor inside<result>/(or accept--voice-bible <path>). - Combined (small single files): Append
## Style & Register,## Characters / Voices, and## Linguistic Briefdirectly insideglossary.md. If both files exist,voice-bible.mdtakes precedence. - Adaptive 2-Pass Polish: Pilot samples, dialogue, narrative prose, game scripts, subtitles, editorial text, and long paragraphs use a mandatory 2-pass workflow (Draft -> Native Grammar & Voice Polish), while short technical UI labels use 1-pass + quick token/length verification. See Voice Bible & Quality.
Drop a tlate.toml in your project root (or pass --config / --profile / --encoding) to configure presets (rpgmaker, unity, renpy, web, mobile, docs, generic), key/file filtering, custom tag patterns, length limits, declarative script rules, and legacy encodings (shift_jis/cp932, utf-16-le, utf-16-be, euc_kr, gb18030, cp1252):
profile = "rpgmaker"
encoding = "shift_jis"
exclude_keys = ["*.id", "*.bgm*", "*.se*"]
max_chars = 120
max_lines = 4
[[protect_patterns]]
name = "custom_hero_tag"
pattern = '\\[hero:\w+\\]'For non-technical users working in Codex, Claude Code, Cursor, Antigravity, or Copilot after running tlate setup ./my-translations:
- Document / PDF / Office Translation:
Translate
documents/report.pdffrom English to Indonesian (--from en --to id) usingtlate. Build the glossary and Voice Bible first, stop for my approval, run a 10-segment pilot with visual comparison and back-translation glosses, then finish QA andtlate verify. - Game / Visual Novel / RPG Translation:
Translate the folder
documents/my_rpg_data/from Japanese to English (--from ja --to en) using--profile rpgmaker(orrenpy) and--encoding shift_jisif needed. Create bothglossary.mdand a separatevoice-bible.mdfor all speakers, stop at Glossary and Pilot checkpoints (showing back-translation glosses and voice rationale), and checkmax_charslimits duringtlate qa. - Web / App Multi-File Project Localization:
Localize
documents/app-locales/from English to German (--from en --to de) as a unifiedtlateproject using--profile web(ormobile). Keep all JSON/ARB/PO/XCStrings placeholders intact, verify German CLDR plural categories intlate qa, and runtlate verifyat the end. - Game or App Patch Update (
tlate sync):Update our localization using
tlate sync: sourcev2is indocuments/locales_v2/, previousv1source is indocuments/locales_v1/, and existing Japanese translations are indocuments/locales_ja_v1/. Seed unchanged lines first and only translate new or modified segments. - Regional / Low-Resource Language Translation:
Translate
documents/storybook.docxinto Javanese (--to jv) usingskills/tlate/references/style-guides/default.mdfor universal calibration. Explain up front which deterministic checks are skipped in generic mode, propose dialect/register choices invoice-bible.md, stop for pilot review with back-translation glosses, and finish with full QA andtlate verify.
Source file or directory (read-only, SHA-256) + optional tlate.toml
│
▼ tlate init / inspect
Inventory + protection checks (refuses encrypted/DRM, flags risky layouts)
│
▼ tlate extract (or tlate ocr / tlate sync --existing-target)
work/segments.jsonl (masked with ⟦Pn⟧ / ⟦Sn⟧ tokens) + work/tm.jsonl
│
▼ tlate glossary-scan / pilot / batch + work/stable-prefix.md + voice-bible.md + glossary.md
AI Agent translates segment text only (Adaptive 2-Pass Polish) --> work/translations/*.jsonl
│
▼ tlate apply (exclusive write xb)
output/<stem>_<LANG>.<ext> OR mirrored output/<rel_path>
│
▼ tlate qa / compare / review-sheet / verify
reports/QA_report.md (constraints, Voice Bible, CLDR plurals) + review_sheet.csv + SHA-256 verify
| Command | Purpose |
|---|---|
tlate setup <dir> |
Prepare an isolated agent workspace (AGENTS.md, CLAUDE.md, GEMINI.md, Cursor/Copilot rules, skills/tlate/, documents/). |
tlate init <src> --to <lang> |
Create a fresh timestamped tlate-output/<name>_<LANG>_<timestamp>/ result folder (single file or directory). |
tlate inspect <src> --to <lang> |
Inspect protection status, format, encoding, risky_layouts, and initial cost_preview. |
tlate extract <src> --result <dir> |
Stream segment extraction (--resume, --existing-target, --previous-source, --config, --profile, --encoding). |
tlate ocr <pdf> --result <dir> |
Hybrid pypdfium2 + pluggable OcrEngine extraction for scanned/mixed PDFs (--overlays, --export-crops). |
tlate sync <src> --result <dir> --existing-target <old> |
Re-seed unchanged translations into work/translations/ via 2-way or 3-way (--previous-source) comparison. |
tlate glossary-scan <segments> |
Extract multi-script recurring terminology candidates (Latin, CJK, Korean, Arabic, Cyrillic, Thai, Devanagari). |
tlate pilot <segments> |
Pick a position/type/speaker-diverse sample (--count N) for Checkpoint 2 review. |
tlate batch <segments> |
Plan resumable, voice-locked, glossary-filtered batches (--voice-bible, --wire-format compact, --fuzzy-tm, --budget-tokens). |
tlate apply --result <dir> |
Strictly validate ⟦Pn⟧ tokens, restore tags/encoding, and write output via exclusive open(..., "xb"). |
tlate compare <src> <out> |
Render side-by-side PNG comparisons (--pages, --zoom). |
tlate qa [<src> <out>] --result <dir> |
Run Smart QA (pass <src> <out> for single files, or --result <dir> alone for project dirs): numbers, placeholders, URLs, glossary, duplicates, max_chars/max_lines/max_bytes, --voice-bible, CLDR plurals, leftovers, typography, optional Hunspell. |
tlate review-sheet --result <dir> |
Export deterministic RFC 4180 CSV review sheet (100% flagged + stratified unflagged sample). |
tlate verify <dir> |
Re-hash source and recorded outputs via SHA-256 to prove zero mutations. |
tlate lang check |
Validate all 24 built-in language packs under languages/ (--json). |
See Architecture for the tlate/segments@1 contract, plugin registry (tlate.formats), and CLI exit codes (0–7).
- Does not guarantee error-free translations.
tlate qais heuristic (max_chars/max_lines/max_bytes, light Voice Bible avoid-term checks, CLDR plural category validation, leftover stopwords, numbers, placeholders, and URLs); manual review and back-translation sampling remain essential. - Any language vs. dedicated packs:
24built-in packs underlanguages/start atstatus: "draft", while unlisted BCP-47 languages use generic fallback (default.md). Both warn up front and listunchecked_rulesinQA_report.md. - Legacy non-UTF-8 encodings: When
--encoding(such asshift_jis,cp932,euc_kr,gb18030,cp1252,utf-16-le) cannot represent target-language characters,tlate applyrefuses with an explicitValidationErrorrather than silently losing text. - Game scripts & binary assets: Complex runtime procedural string concatenation, compiled script bytecode, binary game archives, and text baked inside raster images/textures are not automatically extracted.
- Scanned/mixed PDF OCR fidelity is lower: Original raster fonts, textured backgrounds behind OCR boxes (replaced by solid white
(1, 1, 1)fill duringapply), kerning, skewed/handwritten text, and complex multi-column tables are not preserved verbatim (ocr.md). - Dense PDF overflow & Arabic ligatures: Overflowing boxes after adaptive fit are rendered unclipped (never truncated) and flagged (
overflow_after_adaptive_fit), whileinspectflagsrisky_layouts. Arabic (ar) PDF text extraction emits ToUnicode CMap ligature artifacts (LIMITED_FOR_PDF; see layout-metrics.md). - RTL visual verification:
tlatesetsdir="rtl"/w:bidiand checks RTL script characters, but mixed bidirectional punctuation and number ordering require manual visual review. - No built-in LLM API client:
tlateintentionally performs zero LLM API calls inside the CLI; translation quality depends on your agent's model and human review. - Protected files & legal disclaimers:
tlatenever decrypts password-protected files, never removes DRM, refusesapplyon edit-restricted PDFs, and never produces certified/sworn legal translations (protected-files.md).
- This repository is licensed under the MIT License (LICENSE), and the core
tlatepackage has zero mandatory third-party dependencies. - The optional PDF rewriting backend uses PyMuPDF (
[pdf]), never vendored in this repository and dual-licensed under GNU AGPL-3.0 or an Artifex commercial license. See THIRD_PARTY_NOTICES.md and Security, Privacy & Licensing.
| Area | Guides |
|---|---|
| Setup & Workflow | Getting Started · Voice Bible & Quality · Project Mode, Sync & Plugins · Glossary Guide · QA Guide · Troubleshooting |
| Formats | Games & Subtitles · Subtitles (SRT/VTT) · Web, Mobile & Config · i18n (JSON/ARB/YAML/PO/XML) · PDF · OCR · Office OOXML · HTML & EPUB · Markdown & Text |
| Languages | Adding a Language Pack · Universal Style Guide · Indonesian Style Guide |
| Architecture & Evals | Architecture · Evaluations (37/37) · PDF Layout Metrics · Efficiency & Benchmarks · Known Issues |
| Security & Governance | Security, Privacy & Licensing · Protected Files · Password Mode Design · Python Support · Dependencies Audit · Claims Map · Credits |
| Community & Releases | Contributing · Code of Conduct · Security Policy · Changelog · Release Checklist |
