Translate Book

Translates a whole PDF, DOCX, or EPUB book with parallel sub-agents and a shared glossary, then rebuilds it as EPUB, DOCX, HTML, or PDF.

By Rainman

Software engineer, Baidu

2.1k stars257 forks

About

Translates a whole PDF, DOCX, or EPUB book with parallel sub-agents and a shared glossary, then rebuilds it as EPUB, DOCX, HTML, or PDF.

What it tells your AI to do

Read the book file you point toRun local conversion tools (pandoc, Calibre) and scriptsStart sub-agents and write translated files to a temp folder

Source

@deusyu on GitHubhttps://github.com/deusyu/translate-book

Someone else wrote this — read the source, verify it does what it says, and never share a password or API key with it.

Try it

Translate ./books/my-novel.epub into Spanish with 8 parallel agents, keep character names unchanged, and give me an EPUB back.

Read the source

A skill is instructions your AI follows. Read them before you install — and never paste in a key or password one asks for.

SKILL.md
name
translate-book
description
Translates a whole PDF, DOCX, or EPUB book with parallel sub-agents and a shared glossary, then rebuilds it as EPUB, DOCX, HTML, or PDF.
Read the full instructions (29 lines)
# Translate Book

Use this when someone wants an entire book or long document translated, not a paragraph.

## 1. Collect parameters
Ask for the file path if it is missing. Also take the target language, how many sub-agents to run at once (default 8), and any custom instructions such as tone or names to keep.

## 2. Convert to chunks
Convert the file to Markdown and split it into numbered chunks in a temp folder. For academic PDFs with math, tables, or columns, extract with a layout-aware parser first if one is installed, then chunk the Markdown.

## 3. Build a glossary
Sample the first chunk, the last chunk, and three from the middle. List proper nouns and recurring domain terms (people, places, organizations, concepts) with one chosen translation each, and save the glossary. If a glossary already exists, keep it: the user may have edited it by hand.

## 4. Translate in parallel
Give every chunk its own sub-agent with a fresh context. Each one receives its chunk, the target language, the glossary terms that appear in that chunk, short read-only excerpts of the neighboring chunks, and the custom instructions. It writes only the translation to a matching output file. Run in batches of the chosen size and wait for each batch to finish.

After each batch, merge any new terms the sub-agents reported back into the glossary so later chunks stay consistent.

## 5. Verify
Check that every source chunk has a non-empty output. Retry missing chunks once each. Report any that still fail.

## 6. Rebuild
Translate the book title, merge the chunks in order, and build the formats the user wants: HTML, DOCX, EPUB, or PDF.

## 7. Report
List the output files, the chunk count, any retries, and anything that needs a human look.

Adapted from @deusyu's approach: https://github.com/deusyu/translate-book

Comments

No comments yet — be the first.

More like this

Documents

PDF

Use Claude Code to extract data from contracts, summarize reports, and analyze PDFs. Ask questions in plain English, get answers with page numbers.

Documents

Word Documents

Use Claude Code to create Word documents, fix formatting, and generate reports. Get headers, footers, and table of contents automatically.

Documents

Document Co-authoring

Use Claude Code to co-author documents, refine drafts, and iterate on content. Get AI writing help that preserves your voice.