@JeffreyCalm: Domestic publishers have been heavily focusing on blockbuster foreign book translations in recent years, but this path is coming to an end. Murakami Haruki's latest novel "夏帆" was first released in Japanese on July 3, and a simplified Chinese fine translation based on Claude was already available on Z-Lib by July 6. On Xiaohongshu, feedback generally says it's better than the official translator Lin Shaohua's previous works...
Summary
Introduces an open-source project called "文译" that uses AI models like Claude and DeepSeek to translate multilingual novels (EPUB/FB2/TXT) into Chinese while preserving original formatting. The project is open-sourced on GitHub, supporting resume from breakpoints, glossary, and polishing features.
View Cached Full Text
Cached at: 07/07/26, 11:39 PM
Domestic publishers have been betting heavily on translating foreign bestsellers in recent years, but this approach is reaching its limits. Haruki Murakami’s latest novel, Xia Fan, was first published in Japanese on July 3, and by July 6, a simplified Chinese translation based on the Claude version was already available on Z-Lib. Feedback on Xiaohongshu generally indicated that this translation was better than those by his long-time official translator, Lin Shaohua. The translator even open-sourced the entire long-form translation project on GitHub:
BigDawnGhost/wenyi
Source: https://github.com/BigDawnGhost/wenyi
WenYi
A tool focused on translating multi-language EPUB, FB2, or TXT novels into Chinese, preserving the original EPUB layout, images, table of contents, and hyperlinks as much as possible.
The main entry point for daily use is a single command: translate. It handles pre-scanning, analysis, translation, optional polishing, chapter-end review, punctuation normalization, and EPUB export; it can be resumed after interruption.
Quick Start
uv sync
export DEEPSEEK_API_KEY=sk-...
uv run trans-novel translate book.epub
After translation completes, a Chinese EPUB is generated by default in the source file directory. Running state, chapter JSON, glossary, and reports are stored in the state/ directory.
Resume after interruption:
uv run trans-novel resume book.epub
Check progress:
uv run trans-novel status book.epub
Only re-export EPUB:
uv run trans-novel tools assemble book.epub
Input and Output
- Input: EPUB, FB2, TXT.
- Default output: Chinese EPUB.
- EPUB input: the translated text is backfilled into the original XHTML template, preserving the original book style, images, table of contents, and anchors as much as possible.
- TXT input: a new EPUB is generated.
- Use
--format txtwhen plain text output is required.
Examples:
uv run trans-novel translate book.epub
uv run trans-novel translate book.epub --format txt
uv run trans-novel translate book.epub --chapter 3
Common Flags
uv run trans-novel translate book.epub --polish
uv run trans-novel translate book.epub --no-polish
uv run trans-novel translate book.epub --qa
uv run trans-novel translate book.epub --no-qa
--polish/--no-polish override the pipeline.polish setting in config.yaml. The current repository’s config.yaml has polish: true, so the default without the flag is to polish; the code-level default is false, which only applies when the config file does not have that field.
Polishing adds one strong-tier LLM request per translation batch, which may improve quality but significantly increases time and cost. Already translated batches are skipped when resuming; toggling polishing later will not automatically retranslate old batches.
Configuration
Main settings are in config.yaml:
language.source:autolets the model detect the source language, or you can hardcode a language code (e.g.,ja,en,ko,ru,de).llm.tiers: configure thestrong,cheap, andfastmodel tiers.pipeline.review: chapter-end review.pipeline.autofix_severe: automatically re-translate severe issues and adopt passing results.pipeline.polish: polish Chinese after translation.pipeline.backtranslate_sample: back-translation sampling ratio;0disables it.pipeline.consistency_qa: cross-chapter consistency scan.pipeline.book_understanding: pre-scan the entire book before translation, generating a full book overview and per-chapter summaries.pipeline.rolling_context_segments: number of previous translated segments to carry forward for each batch.segment.max_chars_per_batch: size of each translation batch.segment.max_chars_per_segment: splitting threshold for overly long paragraphs.
For offline testing or debugging, set llm.provider to fake to avoid making network requests.
Workflow
The default continuous workflow is roughly:
Read input
→ Parse chapters, body paragraphs, and EPUB TOC
→ Model detects source language (or uses configured language)
→ Pre-scan entire book, generate full overview and per-chapter summaries
→ Analyze sample chapters, build initial glossary
→ Translate chapter by chapter, batch by batch
→ Optional polish
→ Punctuation normalization
→ Chapter-end review
→ Optional auto-retranslation of severe issues
→ Optional consistency QA
→ Backfill and export EPUB/TXT
Each batch is written to state/ after translation, so long books can be resumed after interruption. Already translated batches are skipped, and only incomplete parts are filled.
Consistency Mechanisms
- Glossary: person names, place names, proper nouns, and honorifics are stored in a SQLite glossary and injected into prompts during translation as configured.
- Book understanding: pre-scan the source text before translating, generating a full book overview and chapter summaries so early chapters can also reference the overall book direction.
- Rolling context: batches within a chapter are processed sequentially; successive batches can see the most recent translated segments.
- Segment alignment: each batch includes N input segments, and the model is required to output N JSON segments; if the count doesn’t match, a retry is made; on persistent failure, segments are processed individually as fallback.
- Chapter-end review: check each chapter for missing translations, mistranslations, terminology, pronoun issues, etc.; by default, issues are only logged; whether to auto-fix is controlled by
autofix_severe. - Punctuation normalization: translated text is standardized to Mainland Chinese simplified Chinese full-width punctuation.
Common Tools
uv run trans-novel tools glossary book.epub list
uv run trans-novel tools glossary book.epub conflicts
uv run trans-novel tools qa book.epub
uv run trans-novel tools report book.epub
uv run trans-novel tools assemble book.epub
These tools are mainly for viewing the glossary, checking consistency, generating reports, or re-exporting the final file. QA and reports by default only summarize issues; they do not automatically fix the text.
Model Tiers
The default configuration uses DeepSeek via the OpenAI SDK at https://api.deepseek.com.
strong: translation, polishing, global analysis, title translation.cheap: chapter-end review, consistency QA, back-translation comparison.fast: full book pre-scan, chapter summaries, glossary extraction, back-translation, and other mechanical tasks.
If model IDs change, simply modify llm.tiers in config.yaml.
Project Structure
trans_novel/
ingest/ Input parsing, EPUB/FB2/TXT splitting
llm/ LLM abstraction interface, DeepSeek provider, FakeClient
glossary/ SQLite glossary, extraction, conflict handling
agents/ Analysis, translation, review, polishing, consistency, prompts
pipeline/ Orchestrator, checkpoint state, rolling context, validation
postprocess/ Punctuation normalization
assemble/ EPUB/TXT backfill export, QA reports
tests/ Offline tests
Testing
UV_CACHE_DIR=/tmp/uv-cache uv run python -m unittest discover -s tests
If your local uv cache directory is writable, you can also run:
uv run python -m unittest discover -s tests
Vision and Limitations
This project was developed for the author’s personal interest, aiming to make a modest contribution to the translation of long-form books. The future goal is to make translations smoother while maintaining accuracy, moving from readability to pleasurable reading. Currently, some issues (inconsistent wording for habitual expressions and inaccurate translation of proper nouns) have been improved! If you encounter any other problems, please submit an issue. If you have any ideas, feel free to discuss them in the discussion area. If you have programming skills, I welcome your PRs to make this project even better. 👏
Similar Articles
@Jolyne_AI: Open-source book AI translation tool: bilingual_book_maker. Use large language models (ChatGPT, Claude, etc.) to quickly translate files and entire books into multiple languages. Supports common formats like epub, txt, srt. Simple process, easy to get started. GitHub: http…
bilingual_book_maker is an open-source AI translation tool that uses large language models like ChatGPT and Claude to quickly translate books in epub/txt/srt/pdf formats into multiple languages. It supports multiple models and adopts Andrew Ng's three-step translation method to improve quality.
@amiaoapp: Tired of slogging through foreign literature and tech blogs? Every time you copy a PDF paragraph into a web translator, you get gibberish line breaks and messy formatting. Have to manually delete spaces and newlines line by line? Infuriatingly slow. Ditch this archaic copy-paste nightmare and send it to the shredder! Recommend a Git…
Recommend an open-source real-time translation tool, CopyTranslator. It supports cross-platform, automatically handles line-break garbled text from PDF copying, enabling copy-to-translate and boosting foreign literature reading efficiency.
@cevenif: Still copy-pasting e-books for translation one paragraph at a time? You've probably wasted a lot of time. Found an open-source gem that just lets you dump the whole book in: TranslateBookWithLLM. Supports EPUB, SRT, DOCX, plain text, and other common formats. Local Ollama...
TranslateBookWithLLM is an open-source desktop application that supports translating documents in EPUB, SRT, DOCX and other formats using local Ollama or cloud APIs, preserving original formatting and supporting resume from breakpoints.
@shachepi: 天下苦沉浸式翻译久矣。 除了昨天的陪读蛙,KISS Translator 也是个顶级平替。 纯粹,完全开源。界面清爽。除了网页翻译,它同样自建接口支持非常全(Claude、Gemini 等各类AI都能接)。不想被商业插件割韭菜,用这种自接…
天下苦沉浸式翻译久矣。 除了昨天的陪读蛙,KISS Translator 也是个顶级平替。 纯粹,完全开源。界面清爽。除了网页翻译,它同样自建接口支持非常全(Claude、Gemini 等各类AI都能接)。不想被商业插件割韭菜,用这种自接 API 的最稳,加载也快,效果还好! 还没找到顺手平替的,再试试这个。 项目地址:https://github点com/fishjar/kiss-translator
@XAMTO_AI: There's a treasure project on GitHub called EBOOK ETC that aggregates resources from WeChat Reading, JD Reading, and Himalaya for centralized management. ① Classic literature, business motivation, career entrepreneurship, technical manuals all available ② Tag classification + search function, finding books is super fast ③ Three formats: epub, mobi, azw3…
This is an open-source project on GitHub that aggregates ebook resources from multiple Chinese reading apps, categorizes them, and supports downloading in multiple formats.