@cevenif: 还在一段段复制粘贴翻译电子书?你可能已经浪费了大量时间。 发现一个开源神器,直接把整本书丢进去就完事了:TranslateBookWithLLM 支持 EPUB 电子书、SRT 字幕、DOCX 文档、纯文本等常见格式 本地 Ollama …

X AI KOLs Timeline 工具

摘要

TranslateBookWithLLM 是一个开源桌面应用,支持使用本地 Ollama 或云端 API 翻译 EPUB、SRT、DOCX 等格式的文档,保留原始排版并支持断点续传。

还在一段段复制粘贴翻译电子书?你可能已经浪费了大量时间。 发现一个开源神器,直接把整本书丢进去就完事了:TranslateBookWithLLM 支持 EPUB 电子书、SRT 字幕、DOCX 文档、纯文本等常见格式 本地 Ollama 模型或 Gemini、OpenAI、DeepSeek 等云端 API 随便选 智能分块处理,上下文连贯不错乱 原有排版结构和格式基本都能保住 再也不用忍受复制粘贴丢格式的折磨了,大规模翻译文档就该这么搞。 https://github.com/hydropix/TranslateBooksWithLLMs…
查看原文
查看缓存全文

缓存时间: 2026/06/09 12:46

还在一段段复制粘贴翻译电子书?你可能已经浪费了大量时间。

发现一个开源神器,直接把整本书丢进去就完事了:TranslateBookWithLLM

支持 EPUB 电子书、SRT 字幕、DOCX 文档、纯文本等常见格式 本地 Ollama 模型或 Gemini、OpenAI、DeepSeek 等云端 API 随便选 智能分块处理,上下文连贯不错乱 原有排版结构和格式基本都能保住 再也不用忍受复制粘贴丢格式的折磨了,大规模翻译文档就该这么搞。 https://github.com/hydropix/TranslateBooksWithLLMs…


hydropix/TranslateBooksWithLLMs

Source: https://github.com/hydropix/TranslateBooksWithLLMs

TBL - Translate Books with LLMs

Download Windows Download macOS Intel Download macOS Apple Silicon

A desktop app that translates books, subtitles, and documents with AI - local or cloud. Drop a file, pick a language, get the result.

Formats: EPUB, SRT, DOCX, TXT

  • No size limit. Process documents of any length - from a single page to thousand-page novels. The intelligent chunking system handles unlimited content while preserving context between segments.
  • Perfect preservation. Your documents come out exactly as they went in: EPUB formatting, styles, and structure remain intact. SRT timecodes stay perfectly synchronized. Every tag, every timestamp, every formatting detail is preserved.
  • Resume anytime. Interrupted translation? Pick up exactly where you left off. The checkpoint system saves progress automatically.

image

Translation Quality Benchmarks - Find the best model for your target language.


Quick Start

  1. Download the release for your platform (buttons above), or grab it from the releases page.
  2. Extract the archive.
  3. Run TranslateBook.exe (Windows) or ./TranslateBook (macOS).
  4. Open http://localhost:5000 in your browser.

That’s it. On first launch, you choose a translation provider:

  • Free & local - Install Ollama and pull a model (e.g. ollama pull qwen3:14b). Nothing leaves your machine.
  • Cloud (often free tier available) - Paste an API key from one of the providers below.

Note: First run creates a TranslateBook_Data folder with your settings.

macOS: On first launch, go to System Settings > Privacy & Security and click Open Anyway.


Providers

Ollama   Poe   OpenRouter   OpenAI   Mistral   DeepSeek   Gemini   NVIDIA NIM

ProviderTypeGet started
DeepSeekCloudplatform.deepseek.com
GeminiCloudGoogle AI Studio
MistralCloudconsole.mistral.ai
NVIDIA NIMCloudbuild.nvidia.com
OllamaLocalollama.com
OpenAICloudplatform.openai.com
OpenAI-CompatibleLocal (llama.cpp, LM Studio, vLLM, LocalAI…)Point to your server’s endpoint
OpenRouterCloud (200+ models)openrouter.ai/keys
PoeCloud (multi-model)poe.com/api_key

See docs/PROVIDERS.md for detailed setup instructions.


Troubleshooting

ProblemSolution
Ollama won’t connectCheck Ollama is running, test curl http://localhost:11434/api/tags
Model not foundRun ollama list, then ollama pull model-name

See docs/TROUBLESHOOTING.md for more solutions.


Advanced

Install from source

Prerequisites: Python 3.8+, Ollama, Git

git clone https://github.com/hydropix/TranslateBooksWithLLMs.git
cd TranslateBookWithLLM
ollama pull qwen3:14b    # Download a model

# Windows
start.bat

# Mac/Linux
chmod +x start.sh && ./start.sh

The web interface opens at http://localhost:5000.

Command line
# Basic (auto-generates "book (Chinese).epub")
python translate.py -i book.epub -sl English -tl Chinese

# With OpenRouter
python translate.py -i book.txt --provider openrouter \
    --openrouter_api_key YOUR_KEY -m anthropic/claude-sonnet-4 -tl French

# With OpenAI
python translate.py -i book.txt --provider openai \
    --openai_api_key YOUR_KEY -m gpt-4o -tl French

# With Gemini
python translate.py -i book.txt --provider gemini \
    --gemini_api_key YOUR_KEY -m gemini-2.0-flash -tl French

# With Mistral
python translate.py -i book.txt --provider mistral \
    --mistral_api_key YOUR_KEY -m mistral-large-latest -tl French

# With DeepSeek
python translate.py -i book.txt --provider deepseek \
    --deepseek_api_key YOUR_KEY -m deepseek-v4-pro -tl French

# With Poe
python translate.py -i book.txt --provider poe \
    --poe_api_key YOUR_KEY -m Claude-Sonnet-4 -tl French

# With NVIDIA NIM
python translate.py -i book.txt --provider nim \
    --nim_api_key YOUR_KEY -m meta/llama-3.1-8b-instruct -tl French

# With local OpenAI-compatible server (llama.cpp, LM Studio, vLLM, etc.)
python translate.py -i book.txt --provider openai \
    --api_endpoint http://localhost:8080/v1/chat/completions -m your-model -tl French

Main options

OptionDescriptionDefault
-i, --inputInput fileRequired
-o, --outputOutput fileAuto: {name} ({lang}).{ext}
-sl, --source_langSource languageEnglish
-tl, --target_langTarget languageChinese
-m, --modelModel nameqwen3:14b
--providerollama/openrouter/openai/gemini/mistral/deepseek/poe/nimollama
--parallelChunks translated concurrently (cloud only; Ollama stays at 1)1
--text-cleanupOCR/typographic cleanupdisabled
--refineSecond pass for literary polishdisabled
--ttsGenerate audio (Edge-TTS)disabled

See docs/CLI.md for all options (TTS voices, rates, formats, etc.).

Configuration (.env)

Copy .env.example to .env and edit:

# Provider
LLM_PROVIDER=ollama

# Ollama
API_ENDPOINT=http://localhost:11434/api/generate
DEFAULT_MODEL=qwen3:14b

# API Keys (if using cloud providers)
OPENROUTER_API_KEY=sk-or-v1-...
OPENAI_API_KEY=sk-...
GEMINI_API_KEY=...
MISTRAL_API_KEY=...
DEEPSEEK_API_KEY=...
POE_API_KEY=...
NIM_API_KEY=...

# Performance
REQUEST_TIMEOUT=900
MAX_TOKENS_PER_CHUNK=450     # Token-based chunking (default: 450 tokens)
PARALLEL_TRANSLATIONS=1      # Concurrent chunks (cloud only; Ollama stays at 1)

Faster on cloud providers? Set PARALLEL_TRANSLATIONS (or --parallel N, or the “Parallel requests” field in the web UI) above 1 to translate several chunks at once. Local providers (Ollama) ignore it since a single instance serializes requests. Higher values are faster but can hit provider rate limits.

Multiple API keys? Any *_API_KEY variable accepts a comma-separated list (e.g. GEMINI_API_KEY=key1,key2,key3). The system rotates between keys automatically when one hits a rate limit - useful to chain free-tier accounts. See docs/API_KEY_ROTATION.md.

Long jobs? Get a push notification on your phone (via ntfy), Discord, Slack, gotify, or any HTTP endpoint when a translation finishes. Set NOTIFY_WEBHOOK_URL in .env. See docs/NOTIFICATIONS.md.

Docker
docker build -t translatebook .
docker run -p 5000:5000 -v $(pwd)/translated_files:/app/translated_files translatebook

See docs/DOCKER.md for more options.


Documentation

GuideDescription
docs/PROVIDERS.mdDetailed provider setup (Ollama, LM Studio, OpenRouter, OpenAI, Gemini)
docs/API_KEY_ROTATION.mdUse multiple API keys per provider with automatic failover on rate-limit
docs/NOTIFICATIONS.mdWebhook notifications on completion (ntfy, gotify, Discord, Slack, custom)
docs/GLOSSARY.mdForce consistent term translations across a book (Web UI + CLI, auto-extract via NER)
docs/CLI.mdComplete CLI reference
docs/TROUBLESHOOTING.mdProblem solutions
docs/DOCKER.mdDocker deployment guide

Star History

Star History Chart

License: AGPL-3.0

相似文章

@amiaoapp: 天天啃外文文献、看国外技术博客,每次想翻译 PDF 段落,复制粘贴到网页翻译里全是一堆莫名其妙的断句和乱码换行?还得自己一行行手动删空格、删换行,效率低到让人原地抓狂?赶紧把这种折寿又折腾的“古法复制粘贴”连夜送进碎纸机! 推荐一款Git…

X AI KOLs Timeline

推荐一款开源的实时翻译工具CopyTranslator,支持跨平台,能自动处理PDF复制时的断行乱码,实现复制即翻译,提升外文文献阅读效率。

@wsl8297: 想把电子书或文档做成有声书?很多工具不是声音太“机器人”,就是不支持字幕同步,折腾一圈还是不满意。 我后来发现了开源项目 Abogen:支持 ePub、PDF、纯文本等,一键转高质量音频,还能自动生成同步字幕。 它底层用 Kokoro 语…

X AI KOLs Timeline

Abogen 是一个开源工具,可将 ePub、PDF 等文档一键转为高质量音频,并自动生成同步字幕,支持语音混合器和多种部署方式。

@Jolyne_AI: 读英文 PDF 论文时,最耗时间的不是内容难,而是被术语和长句反复打断:查译、切窗口、回到原文,再定位一次,阅读节奏全碎了。 如果你用的是开源文献管理工具 Zotero,推荐配上 PDF2zh 这款翻译插件:一键把整篇论文翻成中文,还能保…

X AI KOLs Timeline

介绍 Zotero 的 PDF2zh 翻译插件,支持一键将英文 PDF 论文翻译为中文,保留公式和排版,提供中英对照,并支持多种翻译引擎。