English | 简体中文
Wenyi is a command-line tool for translating EPUB, FB2, TXT, Markdown, HTML, and PDF novels from multiple languages into Chinese. It focuses on long-form translation quality through whole-book analysis, rolling context, an evolving glossary, polishing, and review stages.
Wenyi requires Python 3.10+ and uv.
uv sync
export DEEPSEEK_API_KEY=sk-...
uv run trans-novel translate book.epubBy default, Wenyi writes a monolingual Chinese EPUB to the source file's output/ directory as book.zh.epub. A bilingual source-and-translation edition can be enabled when needed. Runtime state, chapter JSON files, the glossary database, and reports are stored under state/. To continue an interrupted run:
uv run trans-novel resume book.epub
uv run trans-novel status book.epub- Input: EPUB, FB2, TXT, Markdown, HTML, and PDF.
- Output: monolingual EPUB by default, optional bilingual EPUB, or TXT, HTML, and Markdown exports.
- PDF import: the first run uses MinerU and requires
MINERU_API_KEY. The converted HTML is cached atstate/<book>/source/converted.htmland reused by later runs. - EPUB preservation: Wenyi attempts to retain the original styles, images, table of contents, and anchors while converting translated content to horizontal layout.
- Language detection: the source language is detected automatically by default, or it can be fixed to an ISO language code in
config.yaml.
Select output editions from the command line:
uv run trans-novel translate book.epub --bilingual # monolingual and bilingual
uv run trans-novel translate book.epub --no-mono --bilingual # bilingual onlyThe bilingual edition places the translation before the source text by default. Set output.bilingual_order to source_first in config.yaml to reverse the order.
- Usage guide: installation, Windows setup, input and output, resuming, and utility commands.
- Configuration: providers, languages, pipeline switches, segmentation, and paths.
- Translation pipeline: whole-book analysis, terminology, context, polishing, review, and resumability.
- Contributing: development, testing, and contribution guidelines.
Translated state directories for public-domain books may be shared through wenyi-bookcase. Do not publish copyrighted text, private books, or state/ directories containing sensitive information without permission.
Wenyi is an early-stage personal project focused on making long-form machine translation more accurate, consistent, and readable. Reports of inconsistent names, recurring expressions, omissions, formatting problems, and provider compatibility issues are welcome through GitHub Issues and Discussions. Pull requests are also appreciated.
Community:
- Join the Wenyi Discord server
- QQ group: 1055065098
