deusyu/translate-book
Agent skill for Codex, Claude Code, and OpenClaw that translates entire books (PDF/DOCX/EPUB) into any language using parallel subagents.
What it solves
Translating entire books (PDF, DOCX, EPUB) using LLMs often leads to context window overflow, output truncation, and inconsistent terminology (where the same name is translated differently in different chapters). This project provides an automated pipeline to translate large documents in parallel while maintaining linguistic consistency and structural integrity.
How it works
The system operates as an agent skill for runtimes like Codex, Claude Code, and OpenClaw. It follows a multi-step pipeline:
- Conversion: Uses Calibre and Pandoc to convert the input book into Markdown chunks (~6,000 characters each).
- Glossary Generation: Samples the book to extract proper nouns and recurring terms, creating a canonical glossary to ensure consistent translation across all chunks.
- Parallel Translation: Deploys multiple sub-agents (8 by default) to translate chunks concurrently. Each sub-agent receives the relevant glossary terms and short excerpts from neighboring chunks to resolve pronouns and entities.
- Validation: Uses SHA-256 hashes (via a manifest file) to verify that every source chunk has a corresponding, non-empty translation.
- Reconstruction: Merges the translated chunks and uses Pandoc and Calibre to export the final result into HTML, DOCX, EPUB, or PDF formats.
Who it’s for
- Users who need to translate long-form documents or e-books while preserving formatting.
- Developers using AI agent frameworks (Codex, Claude Code, OpenClaw) who want to add high-capacity translation capabilities to their workflow.
Highlights
- Parallel Processing: Uses isolated sub-agents to prevent context accumulation and speed up translation.
- Consistency Tools: Implements a glossary system and neighbor-context excerpts to prevent terminology drift and pronoun errors.
- Resumable Workflow: Tracks state via
run_state.json, allowing the system to resume interrupted runs or selectively re-translate only the chunks affected by glossary changes. - Multi-Format Support: Handles a wide range of inputs and outputs, including PDF, EPUB, and DOCX.
Related
- Project
- Project
- Project
- Project
- Project