Challenge
- The official docs live online, so reading them offline and jumping between pages is awkward
- Writing translations straight into the original pages breaks the HTML and links, with no way back
- English inside diagrams is missed by text translation, and old translations linger after the official images change
Approach
- Save each page as one file with SingleFile and headless Chrome, keep the original folder layout, and rewrite in-site links to relative paths
- Never touch the original elements: add one script line before </body>, which inserts translations and the dictionary popup at run time
- An auditor agent, separate from the translator agents, reviews the translations; diagrams only gain text, and their shapes are not changed by a single byte
Outcome
- A bilingual edition that opens offline with a double-click, with working links between pages
- Every injected layer can be removed in one go, restoring the original file byte for byte
- Adding one site profile file is enough to reuse it on another docs site
This is for readers who study English technical docs in Chinese: it keeps a whole docs site on disk, leaves the English untouched and adds Chinese alongside it. Packaged as a Claude Code plugin, it bundles five skills (saving pages, translating text, translating diagrams, summarising updates, and saving a reference site as a redesign template), translator and auditor agents, and a docs search MCP.
The flow is save → translate → audit → bilingual diagrams → inject. People choose only the target site and its settings; translator agents work through a few pages at a time in parallel, and a different model (or, when it is unavailable, a separate auditor agent) audits them independently.
The full workflow
| Task | Who | Inputs | Outputs |
|---|---|---|---|
| 1. Profile site | Authorauthor | — | Site profile, URL list |
| 2. Save pages | Page grabbergrab.sh | URL list, Refers to Site profile | Mirror pages |
| 3. Translate | Translators + Enginetranslator + run.py | Mirror pages, Refers to Site profile | Translations |
| 4. Audit | Auditor + Audit scriptCodex + codex_audit.py | Translations | Audit report |
| 5. Final review | Main session | Audit report | Accepted fixes |
| 6. Diagrams | Diagram toolsvg_bilingual.py | Mirror pages | Diagrams |
| 7. Inject & check | Engine + Coverage checkrun.py + md_check.py | Accepted fixes, Diagrams | Bilingual page |
| 8. Search | Search MCPsite-doc-search | Bilingual page | Search index |
8 steps · 3 roles · 5 skills · 2 agents · 1 MCP · 5 site profiles
A person writes the site profile, pages are saved one file each, agents translate, a different model audits, and one added line turns each original page into a bilingual edition.
- A person appears only at the start (1): measure the target site and write its selectors into a site profile
- Translation (3) and audit (4) run in separate contexts; the main session decides which findings to accept (5)
- The original is never changed by a single byte: translations, diagrams and the dictionary are inserted at run time and can all be removed
- Reusing it on another site takes one more site profile
Project folders involved (3)
This workflow does not live in one folder: it runs across projects.
- site-bilingual plugin
- The core: five skills, translator and auditor agents, the search MCP and the site profiles
- claude-code-docs-mirror (private repo)
- The first user: every stage was proven here before it was cut out into the plugin
- (private) reading folder
- A private reading folder: the same engine turns English books into bilingual editions
Step 1 · Author
Profile sitesite profile
Measure the target site and record where the text lives and what to skip.
- Selectors for body, headings and code go into the profile, never hard-coded in scripts
- The list of pages to save is drawn up
- It was proven on a second, differently built help site with nothing but a new profile
Common misconceptionSites behind a bot shield refuse headless capture; those pages are taken through a real browser
| Outputs | Site profile, URL list |
Step 2 · Page grabber
Save pagesgrab.sh
Each page is saved, images and CSS included, as one HTML file.
- The original folder layout is kept and in-site links are rewritten as relative paths, so pages link offline
- A setting that keeps hidden tab content is mandatory
- Afterwards it reports successes, failures and suspiciously empty pages
| Inputs | URL list |
| Outputs | Mirror pages |
| Refers to | Site profile |
Step 3 · Translators + Engine
Translatetranslator
Translator agents fill literal and free translations, a few pages at a time in parallel.
- The translation rules are built into the agent's instructions so they do not drift
- Units already translated are left alone; only empty ones are filled
- Agents write only translation data; the main session commits to git one at a time
Claude CodeThe subagent's tools are narrowed by an allow-list, and it may not touch the original HTML
| Inputs | Mirror pages |
| Outputs | Translations |
| Refers to | Site profile |
Step 4 · Auditor + Audit script
Auditcodex audit
A model other than the translator audits, read-only.
- It looks for mistranslations, omissions, inconsistent terms and product terms translated in their everyday sense
- Anything doubtful is marked for review rather than passed
- When the other model is unavailable, an auditor agent in a separate context takes over
Common misconceptionThe auditor only reports; it never edits the translations or the output itself
| Inputs | Translations |
| Outputs | Audit report |
Step 5 · Main session
Final reviewfinal review
The main session accepts or rejects each finding and writes the accepted ones back.
- Only real corrections are accepted
- Changes of meaning, dropped terms and style churn are rejected
- Pages with zero findings skip this gate automatically
| Inputs | Audit report |
| Outputs | Accepted fixes |
Step 6 · Diagram tool
Diagramsbilingual-image
English inside diagrams gets Chinese too, while the diagrams themselves stay unchanged.
- SVG diagrams only gain text; their shapes are not changed by a single byte
- Each build checks that removing all added text gives back the original exactly, and writes nothing otherwise
- When an official diagram changes, its old translation is rebuilt rather than reused
| Inputs | Mirror pages |
| Outputs | Diagrams |
Step 7 · Engine + Coverage check
Inject & checkaudit-reviewed
One line added to the original page inserts translations, diagrams and the dictionary at run time.
- Only one script line is added before </body>; original elements, attributes and links stay as they are
- The dictionary finds the word under the pointer without wrapping the original text
- A coverage check then reports how many blocks still lack a translation
Common misconceptionEvery injected layer can be removed, restoring the original file byte for byte
| Inputs | Accepted fixes, Diagrams |
| Outputs | Bilingual page |
Step 8 · Search MCP
Searchsearch_docs
The bilingual pages become searchable by full text and vectors.
- The search server ships inside the plugin, with its index alongside
- It also matches by meaning, so a different translation of a term still finds the page
- A status command lists page counts, bilingual coverage, index freshness and the translation backlog
Claude CodeAn MCP server inside a plugin becomes available as soon as the plugin is installed
| Inputs | Bilingual page |
| Outputs | Search index |
Key points
Only add, never edit. Original elements, attributes and links stay as they are; the only addition is one script line before </body>. Translations are inserted at run time as sibling nodes, and dictionary lookup locates the word under the pointer without wrapping the original text.
Keep translating and auditing apart. Translator agents write only the translation data; an auditor in a separate context (preferring an external Codex review) checks them and reports issues. It misses less than reviewing your own work in the same context.
Diagrams follow the same rule. SVG diagrams only gain text, and every build checks that removing all text gives back exactly the original image; if not, nothing is written. When the official image changes, the old translation is rebuilt rather than silently reused.