Challenge
- A translation alone hides the original wording; the original alone means looking up word after word
- When AI translates a whole book in one go, dropped paragraphs or silent summarising go unnoticed
Approach
- First convert the EPUB into a reading edition and verify by machine that its text matches the EPUB character for character
- Split the original into units with IDs and let parallel agents write only the translations. Separate agents sample for errors, and a judge decides what to apply
Outcome
- One HTML file shows literal and free translations under the original, with meanings on hover
- Scripts own the original text, so however the translation varies the original never breaks; progress is tracked as one sub-task per chapter
This is the workflow the author uses to read English and Japanese books alongside Chinese. English EPUBs go through a reading edition and then an English–Chinese edition; fixed-layout Japanese books are read from page images into a Japanese–Chinese edition.
On both routes scripts produce the original text and the model writes only translations. Book content is copyrighted, so it stays for personal reading; only the procedure and the scripts are shared.
The full workflow
| Task | Who | Inputs | Outputs |
|---|---|---|---|
| 1. Build copy | Builderbuild.py | Source EPUB | Reading copy |
| 2. Verbatim check | Verifierverify.py | Reading copy | Verbatim check |
| 3. Split units | Extractor + Sharderextract_book.py + shard.py | Verbatim check | Source units |
| 4. Translate | Translators + Workflow script + Mergersubagents + workflow .js + merge.py | Source units, Refers to Rules+glossary | Translations |
| 5. Sample review | Reviewers + Sampler + Workflow scriptsubagents + sample_review.py + workflow .js | Translations | Review notes |
| 6. Judge fixes | Judge + Collector + Workflow scriptsubagent + build_fixes.py + workflow .js | Review notes | Fix list |
| 7. Apply fixes | Applierapply_fixes.py | Fix list | Revised text |
| 8. Dictionary | Dict builderbuild_dict.py | Source units | Dictionary |
| 9. Assemble | Assemblerassemble.py | Revised text, Dictionary | Bilingual HTML |
9 steps · 3 roles · 2 loops · since 2026-08-24 · 1,339 units in one book · 77 fixes over 2 review rounds
Scripts turn the EPUB into a reading copy without changing a character, agents write only translations, other agents sample for errors, a judge decides what to apply, and the bilingual edition is assembled.
- Scripts produce the original text (1–3, 8–9); agents write translations (4). However translations vary, the original cannot break
- Translation (4) and error-hunting (5) run in separate contexts; the judge (6) may also reject findings
- Two loops: a mismatch sends you back to the conversion rules; many fixes trigger another sample round with a new seed
- Book content is copyrighted and stays for personal reading; only the procedure and scripts are shared
Project folders involved (3)
This workflow does not live in one folder: it runs across projects.
- (private) reading folder
- A private reading folder: the conversion, verification and bilingual scripts and the translation spec; book content stays out of the repository
- reading-kit plugin
- The author's plugin: it holds the reading-copy skill and the English and Japanese bilingual skills
- site-bilingual plugin
- The injection engine and dictionary builder come from here
Step 1 · Builder
Build copybuild.py
The EPUB becomes a single-file reading copy with a table of contents.
- Each book gets one entry in the register: category, title, language and conversion profile
- Print-only clutter is hidden by default and the contents sit in a sidebar
- Quirks of a particular book are fixed in its profile; the generated HTML is never edited by hand
| Inputs | Source EPUB |
| Outputs | Reading copy |
Step 2 · Verifier
Verbatim checkverify.py
A script checks that the reading copy matches the EPUB character for character.
- It compares the full text and stops at the first divergence
- Nothing moves on until they match
- Fixes go into the conversion rules; output is never patched by hand to match
Common misconceptionText can look right yet drop characters after a hidden node; the verbatim check catches that
| Inputs | Reading copy |
| Outputs | Verbatim check |
Step 3 · Extractor + Sharder
Split unitsextract_book.py
The text is split into units with IDs and cut into shards for translation.
- Pages with nothing to translate, such as the index, are skipped
- One technical book came to 1,339 units in 34 shards
- Book-specific rules and a glossary are added to the translation spec (code lines are copied as-is, for example)
| Inputs | Verbatim check |
| Outputs | Source units |
Step 4 · Translators + Workflow script + Merger
Translateone per shard
One agent per shard writes only the literal and free translations.
- Translations are keyed by unit ID, so the original is never touched
- Units whose translation equals the original, such as code lines, are not inserted, so nothing prints twice
- An earlier art book was translated in full: 3,439 of 3,439 units
Claude CodeA workflow script starts one subagent per shard and runs them in parallel
| Inputs | Source units |
| Outputs | Translations |
| Refers to | Rules+glossary |
Step 5 · Reviewers + Sampler + Workflow script
Sample reviewone per packet
Agents in a separate context look only for errors in sampled units.
- Four things only: omissions, additions, mistranslations and inconsistent terms; style preferences are not reported
- A fixed seed makes the sample reproducible, and repeated draws never overlap until everything is covered
- Even with zero issues a result file is kept as proof of review
| Inputs | Translations |
| Outputs | Review notes |
Step 6 · Judge + Collector + Workflow script
Judge fixesveto allowed
A judge agent rules on each finding, accept or reject.
- Findings from all packets are merged into one candidate list
- The judge has a veto and writes only what it accepts
- The judge never edits the translations themselves
| Inputs | Review notes |
| Outputs | Fix list |
Step 7 · Applier
Apply fixesapply_fixes.py
Accepted fixes are written back, after a dry run and a backup.
- Before writing, each fix's "before" text must match the current translation, or it is skipped
- Round 1 checked 240 units: 22 findings accepted, 36 places fixed; round 2 used a new seed on 360 units: 26 accepted, 41 places
- If many places changed, another sample round with a new seed follows
| Inputs | Fix list |
| Outputs | Revised text |
Step 8 · Dict builder
Dictionarybuild_dict.py
A dictionary limited to the book's words is built for hover lookup.
- Words are collected with code lines left out
- The full dictionary stays on this machine and never enters the repository
- Where useful, a "usage in this book" sense is added
| Inputs | Source units |
| Outputs | Dictionary |
Step 9 · Assembler
Assembleassemble.py
Translations and the dictionary are injected into the reading copy as one bilingual file.
- Injection uses the same engine as the site mirror, and the reading copy's text is not changed by a character
- Literal and free translations sit under each English block, with meanings on hover
- Progress is tracked as one task per chapter
| Inputs | Revised text, Dictionary |
| Outputs | Bilingual HTML |
Loops and rework
- Verbatim mismatch → step 1: Fix the conversion rules (the book's profile) and rebuild; never patch the HTML
- Many fixes applied → step 5: For one technical book a second round really ran with a new seed and 26 more findings were accepted
Key points
Never change a character of the original. The reading edition is compared with the EPUB in full, character by character, and nothing moves on until they match. Fixes go into the conversion rules; generated HTML is never edited by hand.
Let the model write only translations. The original is split into units with IDs, and translations are inserted by ID. Units whose translation equals the original, such as code lines, are not inserted, so nothing is printed twice.
Keep translating and error-hunting apart. Sampling reviewers run in a different context from the translators and report only omissions, additions, mistranslations and inconsistent terms, never style preferences. The judge that applies fixes may also reject them.