epub-translator
Translate EPUB books using Large Language Models while preserving the original text. The translated content is displayed side-by-side with the original, creatin
What is epub-translator?
Translate EPUB books using Large Language Models while preserving the original text. The translated content is displayed side-by-side with the original, creating bilingual books perfect for language learning and cross-reference reading.
Overview of epub-translator
What it is
EPUB Translator is an open-source tool that translates EPUB books using Large Language Models (LLMs) while preserving the original text. The translated content is displayed side-by-side with the original, creating bilingual books suitable for language learning and cross-reference reading. It is licensed under MIT and available as a Python package.
Key features
- Preserves original formatting, images, and structure of the EPUB file - Supports three translation insertion modes: replace original text, append as inline text, or append as block elements - Provides predefined language constants for common languages and allows custom language strings - Includes progress tracking and error handling with automatic retries (default 5 retries)
- Can use separate LLM instances for translation and XML filling for task-specific optimization - Requires Python 3.11, 3.12, or 3.13
Use cases
- Language learners who want to read foreign books with the original text alongside the translation - Researchers who need to compare original and translated content in academic works - Readers who wish to enjoy foreign literature while retaining the original context - Anyone creating bilingual EPUB editions for personal or educational use
Getting started
Install the package: bash pip install epub-translator A minimal translation example: python from epub_translator import LLM, translate, language, SubmitKind llm = LLM(key='your-api-key', url='https://api.openai.com/v1', model='gpt-4', token_encoding='o200k_base') translate(source_path='source.epub', target_path='translated.epub', target_language=language.ENGLISH, submit=SubmitKind.APPEND_BLOCK, llm=llm) For a visual interface, the README recommends using OOMOL Studio.
License and pricing
The project is open source under the MIT license. No pricing information is provided beyond the open-source nature.
Based on the project's public README and repository metadata.