Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Tolmach — AI Book Translator

Translate a whole novel on your own computer.
Open-source AI book translator powered by Ollama, with local models or Ollama Cloud.
Consistent names. Verified edits. Your text stays under your control.

EPUB · PDF · DOCX · TXT  →  a finished book in your language, ready to read.

Your browser does not support inline video. Watch on YouTube

Get started in one command

# macOS / Linux
git clone https://github.com/KazKozDev/book-translator.git && cd book-translator && python3 launch.py
# Windows
git clone https://github.com/KazKozDev/book-translator.git
cd book-translator
py -3 launch.py

No Git? Download the ZIP, unpack it, and double-click the launcher for your system: Launch Book-Translator.command on macOS, Launch Book-Translator.bat on Windows, Launch Book-Translator.sh on Linux. Python 3.10+ has to be installed.

Download ZIP for macOS Download ZIP for Windows Download ZIP for Linux

The launcher creates a virtual environment, installs dependencies, checks Ollama and models, starts Tolmach at http://localhost:5001, and opens your browser. Then pick a model per role in Settings and follow the numbered buttons.

Chat translators break books

Paste a chapter into a chatbot and you get a decent page. Do it for 400 pages and the problems show up:

Without TolmachWith Tolmach
The hero's name changes between chaptersA glossary built from the whole book locks every name, place, and term
"Improve this" passes rewrite good wordingOnly small, located edits — each checked against the source
Untranslated passages slip throughSource-language leftovers are detected and patched
You paste chunks, then reassemble by handUpload the book, download the book
Your manuscript goes to someone else's serverRuns on your computer with local Ollama models; cloud models only if you choose them

How the AI book translator works

Upload → Prepare → Start → Continue → Review → Download

1. Prepare

Scans the entire book and proposes a glossary of characters, places, organisations, and terms. You approve it before anything is translated.

2. Start

Translates in chunks with genre, glossary rules, and the previous paragraph as context. Finished sections appear while the rest keeps running.

3. Continue

A refinement model proposes small edits. A separate verifier checks each one against the source before it touches the text.

Then open the Review desk: source, first draft, and editable final text side by side. Export to TXT, PDF, or EPUB.

Features

Glossary that stays consistent

  • Built from the full book, with exact, inflectable, and preferred rules and {notes} the translator obeys
  • Shared glossary carries approved entries across chapters of one novel
  • Copy frontier prompt has an external model research the lore and write notes only where it is certain. Read them first: a wrong note is one the translator will obey
Netherfield => Незерфилд | exact
Mr. Darcy   => мистер Дарси | inflectable

Safe edits, full control

  • Only small, located edits, each verified against the source. Edits that leak source text or delete passages are rejected
  • Review desk: source, draft, and editable final text side by side, with a Needs review filter and 2–3 alternatives on any passage
  • Refinement mode: auto-apply, suggest only, or skip
  • Pause at the next chunk boundary to free the GPU, Resume after a restart, reopen any job from the Archive
  • Quality checks flag missing text, changed numbers, glossary violations, and repetition. They report, never rewrite

Books in, books out

  • In: TXT, EPUB, PDF, DOCX. Out: TXT, PDF, EPUB
  • PDF is read as text: running heads and page numbers removed, chapters from bookmarks or headings. Layout and images are not kept; scanned PDFs need OCR first
  • DOCX keeps Heading 1 sections as chapters

Private by design

  • The app, glossary, and job data run on localhost with SQLite
  • Local models keep the book on your computer. Ollama Cloud models (the -cloud ones) send text to Ollama's servers, so use local models for sensitive manuscripts
  • Optional cloud glossary verification sends only the glossary and language pair, never the book

Translate EPUB and PDF books in 11 languages

Any of 11 languages as source or target: English, Russian, Spanish, French, German, Italian, Portuguese, Chinese, Japanese, Korean, and Turkish. Click a thumbnail for the full size.

English to Russian
ru_RU
English to Spanish
es_ES
English to French
fr_FR
More screenshots
English to German
de_DE
English to Italian
it_IT
English to Portuguese
pt_BR
English to Chinese
zh_CN
English to Japanese
ja_JP
English to Korean
ko_KR

What you need

  • Ollama on the same computer, Python 3.10+ (installed via uv if missing), and enough memory and disk for your models
  • Minimum models: translategemma:12b for translation plus gemma4:31b for the other roles
  • Author's stack (cloud open-source models): Glossary and Refinement gemma4:31b-cloud, Translation translategemma:27b, Verifier and Judge mistral-large-4:cloud

Honest expectations

  • A full book takes 10–15 hours on local hardware. This is a pipeline, not a chat reply.
  • Quality depends on your models; smaller ones run with lower quality.
  • Models can still miss errors. Proofread before you publish.
Under the hood
Browser
   ↓
Flask UI + JSON API
   ↓
Prepare → Start → Continue → Review
   ↓         ↓         ↓
Glossary   Ollama   Verifier
   └───────── SQLite ─────────┘
                ↓
          TXT / PDF / EPUB
  • Prepare — text harvesting and GLiNER collect candidates; BGE-M3 groups spelling variants; an instruct model proposes renderings.
  • Start — chunks of about 1200 characters split at paragraph and sentence boundaries, streamed to SQLite and the browser.
  • Continue — located edits, deterministic guards, verifier with position-bias retry.
  • Quality checks — deterministic checks plus optional LLM judge, backtranslation chrF, LaBSE alignment, and COMET-Kiwi; wrong-language passages are flagged too.
  • Storage — translations.db (jobs, chunks, glossary, review state), cache.db (chunk cache for resumes).

Key files: launch.py, src/translator.py, src/terminology.py, src/quality_tests.py, src/epub_io.py, src/pdf_io.py, src/frontier_glossary.py, src/translation_cache.py, src/prompts/, tests/.

Configuration
SettingDefaultMeaning
App addresshttp://localhost:5001Set PORT to change
Reachable fromThis computer onlyHOST=0.0.0.0 opens it to your network (no login — trusted networks only)
Ollama addresshttp://localhost:11434Local model server
Translation modeltranslategemma:12b preferredUsed by START
Glossary / RefinementFirst suitable instruct modelUsed by PREPARE / CONTINUE
VerifierDifferent from RefinementChecks proposed edits
JudgeDifferent from TranslationOptional diagnostics
Chunk size1200 charactersParagraphs first, then sentences
GenreAutoFiction, Technical, Academic, Business, Poetry
Glossary verificationOffSet OPENAI_API_KEY, ANTHROPIC_API_KEY, or GEMINI_API_KEY
COMET-KiwiOffSet HF_TOKEN after gated-model access
Development
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements-dev.txt
python -m pytest tests -q
ruff check .

Tests need no Ollama, models, or network.

License

AGPL-3.0-only



License: AGPL-3.0-only CI Python 3.10+

Issues · Changelog · Contributing · Disclaimer · LinkedIn

关于 About

Tolmach — open-source AI book translator powered by Ollama. Translate EPUB, PDF, DOCX and full novels with local LLMs or Ollama Cloud, with glossaries, verified refinement, and side-by-side review.
ai-book-translatorai-translationbook-translationbook-translatordesktop-appebookebook-translatorepubepub-translatorliterary-translationlocal-firstlocal-llmmachine-translationnovel-translatorollamapdf-translationpythontranslationtranslatortranslator-app

语言 Languages

Python65.3%
HTML34.1%
Shell0.6%
Batchfile0.0%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
115
Total Commits
峰值: 36次/周
Less
More

核心贡献者 Contributors