Translate EPUB books between languages using AI code assistants while preserving formatting, structure, and metadata.
Works with: Claude Code, Gemini CLI, Cursor, Codex, GitHub Copilot, and any AI assistant
πΊ Live Demo & Screenshots - See what the translation process looks like
π¬ Video Tutorial - 3-minute walkthrough (coming soon)
Want to see real examples? Check out the Baneblade case study showing a complete 300-page book translation.
- β Preserves Structure - HTML/XML tags, CSS styling, and formatting stay intact
- β Maintains Navigation - Chapter structure, TOC, and metadata preserved
- β Smart Translation - Protects proper names and technical terms
- β Glossary Support - Use translation dictionaries for consistency (i18n-style)
- β Community Glossaries - Pre-made dictionaries for popular universes (Warhammer 40k, Harry Potter)
- β Batch Processing - Translate multiple chapters/pages in parallel
- β Universal Compatibility - Works with ANY AI assistant
- β Native Claude Skill - Fully automated for Claude Code users
-
Clone this repository:
cd ~/.claude/skills/ git clone https://github.com/vbalko-claimate/epub-translator.git
-
Translate a book:
claude "translate this EPUB book from English to Czech: book.epub" -
π‘ Consider skipping permissions (optional but recommended):
claude --dangerously-skip-permissions "translate this EPUB book from English to Czech: book.epub"Why skip permissions?
- β Auto-approves all file operations (no manual confirmations)
- β Much faster workflow (10-50+ chapters = 10-50+ approvals saved)
- β Automatic validation runs without interruption
β οΈ Trade-off: Less control, but skill is designed to be safe
That's it! Claude will automatically extract, translate, and rebuild your EPUB.
π Detailed Installation Guide β
For EPUB:
-
Extract the EPUB:
mkdir epub_workspace unzip book.epub -d epub_workspace/
-
Use prompt templates from
prompts/directory:- Copy each prompt in sequence
- Paste into your AI assistant (Claude web, Gemini, Cursor, etc.)
- Follow the step-by-step instructions
-
Rebuild the EPUB:
cd epub_workspace zip -0 -X ../translated.epub mimetype zip -r ../translated.epub META-INF OEBPS
If you have a PDF book, you can convert it to EPUB and then translate it:
Prerequisites:
- None! Pure Python (auto-installs ALL dependencies on first run)
Workflow:
# 1. Convert PDF to EPUB
python scripts/convert_pdf_to_epub.py mybook.pdf
# 2. Translate the EPUB (existing workflow)
claude "translate mybook.epub from English to Czech"Quality expectations:
- Good for: Novels, simple text books, standard layouts
- Acceptable for: Technical books with some tables/diagrams
- Not suitable for: Multi-column papers, scanned PDFs, layout-critical documents
Image handling:
- β Extracts embedded images from PDF
- β Preserves JPEG, PNG, GIF, TIFF formats
- β Automatically embeds images in EPUB
β οΈ Images placed at end of each chapterβ οΈ Small decorative images (<100x100px) filtered out
Important: PDFβEPUB conversion is lossy (layout changes from fixed to reflowable). If you need to preserve exact PDF formatting, use a dedicated PDF editor instead.
Book: Baneblade by Guy Haley (Warhammer 40k) Pages: 300+ Chapters: 31 (Prologue, Chapters 1-29, Epilogue) Time: ~2 hours Quality: All proper names preserved, formatting intact, valid EPUB
EPUB files are ZIP archives containing XHTML files for each chapter. This workflow:
- Extracts the EPUB to access individual chapter files
- Translates each chapter while preserving HTML structure
- Updates metadata (language codes, TOC labels)
- Rebuilds everything into a valid EPUB
book.epub (ZIP)
βββ mimetype
βββ META-INF/container.xml
βββ OEBPS/
βββ content.opf (metadata - update language)
βββ toc.ncx (navigation - translate labels)
βββ chapter-1.xhtml (translate content)
βββ chapter-2.xhtml (translate content)
βββ css/ (preserve untouched)
βββ images/ (preserve untouched)
Learn more about EPUB structure β
Any language pair! Examples:
- π¬π§ English β π¨πΏ Czech
- π«π· French β π¬π§ English
- πͺπΈ Spanish β π©πͺ German
- π―π΅ Japanese β π¬π§ English
- And any other combination!
- How It Works - Understanding EPUB structure
- Glossary System - π Control translations with dictionaries
- Context Management -
β οΈ Critical: Avoid running out of memory - Troubleshooting - Common issues and solutions
- Examples - Step-by-step walkthrough sessions
Use pre-made dictionaries for consistent translations:
- π Warhammer 40,000 (enβcs) - Official + community terms
- π Template (template.txt) - Create your own glossary
How glossaries work:
PRESERVE: Cortein β Never translate (character name)
TRANSLATE: Mars β Mars β Use specific translation
PRESERVE_WITH_GRAMMAR: bolter β Keep word, apply Czech cases (bolteru, bolterem)
CONTEXT: Chapter β depends β "Kapitola" in headings, "ΕΓ‘d" for military units
Usage:
# Claude Code
claude "translate book.epub using glossary warhammer40k-en-cs.json"
# Manual (any AI)
# Include glossary terms in your translation promptsLearn more about glossaries β
| Feature | Claude Skill | Universal Prompts |
|---|---|---|
| Automation | Fully automated | Semi-manual |
| AI Compatibility | Claude Code only | Any AI assistant |
| Setup Complexity | Install once | Copy-paste prompts |
| Speed | Fastest (~2 hrs) | Slower (~3-4 hrs) |
| Best For | Repeat translations | One-time use |
All users need:
- ZIP/UNZIP utilities (built-in on Mac/Linux, install on Windows)
- An EPUB file to translate
- Access to an AI code assistant
Claude Code users additionally need:
- Claude Code CLI installed
- Skill installed in
~/.claude/skills/epub-translator
- Proper names: Characters, places, organizations (e.g., "Mars Triumphant" stays as-is)
- Technical terms: Genre-specific terminology (e.g., "Baneblade", "lascannon")
- HTML structure: All tags, CSS classes, image references
- Formatting: Bold, italics, paragraph styles
- Narrative text: Dialogue, descriptions, narration
- Chapter titles: "Chapter 1" β "Kapitola 1" (or your target language)
- Metadata: Table of Contents, About the Author sections
- Navigation labels: Prologue β Prolog, Epilogue β Epilog
See translation best practices β
Contributions are welcome! Whether it's:
- π Bug fixes
- β¨ New features
- π Documentation improvements
- π Prompt templates for new AI assistants
See CONTRIBUTING.md for guidelines.
- Support for more ebook formats (MOBI, AZW3)
- GUI application for non-technical users
- Enhanced translation memory/glossary support
- Batch translation of multiple books
MIT License - see LICENSE file for details.
Created by Vladimir Balko
Inspired by translating "Baneblade" by Guy Haley (Warhammer 40k novel) from English to Czech.
- π Blog Post: How I Translated a 300-Page Book in 2 Hours
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- β Star this repo if you find it useful!
Made with β€οΈ for book lovers who can't wait for official translations