Skip to main content

tlate (0.2.0)

PyPI Python License: MIT CI

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


Why tlate?

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.

Quick Start

1. Install

# 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-translations

Place 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.


Supported Formats

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)

Visual PDF Comparison (tlate compare)

Actual tlate compare output on a synthetic PDF fixture (preserving colored callout boxes, raster images, {app_name} placeholders, and URLs):

Side-by-side comparison of source PDF and translated PDF

Multi-Language Support (--from auto, required --to): Ships 24 built-in language packs under languages/ (checked via tlate 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).


Usage Guides

1. Single-File Mode

--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>

2. Multi-File / Project Mode (tlate init <dir>)

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.

3. Incremental / Patch Sync (tlate sync)

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

4. Voice Bible (Separated vs. Combined) & Adaptive 2-Pass Polish

  • Separated (default): Store terminology + forbidden translations in <result>/glossary.md and style/register, speaker character cards, and linguistic briefs in <result>/voice-bible.md. tlate batch and tlate qa auto-detect voice-bible.md beside glossary.md or inside <result>/ (or accept --voice-bible <path>).
  • Combined (small single files): Append ## Style & Register, ## Characters / Voices, and ## Linguistic Brief directly inside glossary.md. If both files exist, voice-bible.md takes 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.

5. tlate.toml Configuration, Presets & Non-UTF-8 Encodings

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+\\]'

Copy-Paste AI Agent Prompts

For non-technical users working in Codex, Claude Code, Cursor, Antigravity, or Copilot after running tlate setup ./my-translations:

  1. Document / PDF / Office Translation:

    Translate documents/report.pdf from English to Indonesian (--from en --to id) using tlate. 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 and tlate verify.

  2. Game / Visual Novel / RPG Translation:

    Translate the folder documents/my_rpg_data/ from Japanese to English (--from ja --to en) using --profile rpgmaker (or renpy) and --encoding shift_jis if needed. Create both glossary.md and a separate voice-bible.md for all speakers, stop at Glossary and Pilot checkpoints (showing back-translation glosses and voice rationale), and check max_chars limits during tlate qa.

  3. Web / App Multi-File Project Localization:

    Localize documents/app-locales/ from English to German (--from en --to de) as a unified tlate project using --profile web (or mobile). Keep all JSON/ARB/PO/XCStrings placeholders intact, verify German CLDR plural categories in tlate qa, and run tlate verify at the end.

  4. Game or App Patch Update (tlate sync):

    Update our localization using tlate sync: source v2 is in documents/locales_v2/, previous v1 source is in documents/locales_v1/, and existing Japanese translations are in documents/locales_ja_v1/. Seed unchanged lines first and only translate new or modified segments.

  5. Regional / Low-Resource Language Translation:

    Translate documents/storybook.docx into Javanese (--to jv) using skills/tlate/references/style-guides/default.md for universal calibration. Explain up front which deterministic checks are skipped in generic mode, propose dialect/register choices in voice-bible.md, stop for pilot review with back-translation glosses, and finish with full QA and tlate verify.


How It Works & CLI Reference

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).


Honest Limitations

  • Does not guarantee error-free translations. tlate qa is 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: 24 built-in packs under languages/ start at status: "draft", while unlisted BCP-47 languages use generic fallback (default.md). Both warn up front and list unchecked_rules in QA_report.md.
  • Legacy non-UTF-8 encodings: When --encoding (such as shift_jis, cp932, euc_kr, gb18030, cp1252, utf-16-le) cannot represent target-language characters, tlate apply refuses with an explicit ValidationError rather 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 during apply), 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), while inspect flags risky_layouts. Arabic (ar) PDF text extraction emits ToUnicode CMap ligature artifacts (LIMITED_FOR_PDF; see layout-metrics.md).
  • RTL visual verification: tlate sets dir="rtl" / w:bidi and checks RTL script characters, but mixed bidirectional punctuation and number ordering require manual visual review.
  • No built-in LLM API client: tlate intentionally performs zero LLM API calls inside the CLI; translation quality depends on your agent's model and human review.
  • Protected files & legal disclaimers: tlate never decrypts password-protected files, never removes DRM, refuses apply on edit-restricted PDFs, and never produces certified/sworn legal translations (protected-files.md).

License & PyMuPDF Notice

  • This repository is licensed under the MIT License (LICENSE), and the core tlate package 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.

Documentation

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

Metadata

Release files for tlate 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tlate 0.2.0
File Size Uploaded Provenance Actions
tlate-0.2.0.tar.gz 314.7 kB With provenance Details for tlate-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tlate 0.2.0
File Interpreter ABI Platform Actions
tlate-0.2.0-py3-none-any.whl Python 3 none any Details for tlate-0.2.0-py3-none-any.whl

Total release size: 633.9 kB

Release files / tlate-0.2.0.tar.gz

Download URL tlate-0.2.0.tar.gz
Size 314.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6560609207c76b83d2be37049d8c7b0a5495b5d80f2c9912d4994d119bd5038b
BLAKE2b-256 checksum
How to use checksums
7aae15d2e22e123405b59324fa81e699337701bed2abfea769de03e7937004c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / tlate-0.2.0-py3-none-any.whl

Download URL tlate-0.2.0-py3-none-any.whl
Size 319.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73dd0a35b5e7dd5349c255cb42b56bbae1deca9e3546d6da6faeccf9b10fa691
BLAKE2b-256 checksum
How to use checksums
40697a2312bc217d553cfd181c2902207241a7d474389d85689ea952c0fa408d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for tlate 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tlate-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page