Bilingual docs-site mirror plugin

Saves an English docs site one file per page and produces an offline English-Chinese side-by-side edition.

#Claude Code plugin#offline mirror#SingleFile#English-Chinese#dictionary popup
site-bilingual plugin

Workflowsite-bilingual plugin

Sites & i18n Claude Code plugin

A Claude Code plugin that saves a docs site as single-file HTML pages with SingleFile and headless Chrome, then turns them into a study edition: a literal and a free Chinese translation under each English block, and an English-Chinese dictionary on mouse hover. It also handles bilingual diagrams and summaries of what changed.

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

TaskWhoInputsOutputs
1. Profile siteAuthorauthor—Site profile, URL list
2. Save pagesPage grabbergrab.shURL list, Refers to Site profileMirror pages
3. TranslateTranslators + Enginetranslator + run.pyMirror pages, Refers to Site profileTranslations
4. AuditAuditor + Audit scriptCodex + codex_audit.pyTranslationsAudit report
5. Final reviewMain sessionAudit reportAccepted fixes
6. DiagramsDiagram toolsvg_bilingual.pyMirror pagesDiagrams
7. Inject & checkEngine + Coverage checkrun.py + md_check.pyAccepted fixes, DiagramsBilingual page
8. SearchSearch MCPsite-doc-searchBilingual pageSearch index
site-bilingual plugin

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

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

OutputsSite profile, URL list
Save pages

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
InputsURL list
OutputsMirror pages
Refers toSite profile
Translate

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

InputsMirror pages
OutputsTranslations
Refers toSite profile
Audit

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

InputsTranslations
OutputsAudit report
Final review

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
InputsAudit report
OutputsAccepted fixes
Diagrams

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
InputsMirror pages
OutputsDiagrams
Inject & check

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

InputsAccepted fixes, Diagrams
OutputsBilingual page
Search

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

InputsBilingual page
OutputsSearch 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.