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.
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.
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 Tolmach |
With Tolmach |
| The hero’s name changes between chapters |
A glossary built from the whole book locks every name, place, and term |
| “Improve this” passes rewrite good wording |
Only small, located edits — each checked against the source |
| Untranslated passages slip through |
Source-language leftovers are detected and patched |
| You paste chunks, then reassemble by hand |
Upload the book, download the book |
| Your manuscript goes to someone else’s server |
Runs 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.
More screenshots

de_DE |

it_IT |

pt_BR |

zh_CN |

ja_JP |

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
| Setting |
Default |
Meaning |
| App address |
http://localhost:5001 |
Set PORT to change |
| Reachable from |
This computer only |
HOST=0.0.0.0 opens it to your network (no login — trusted networks only) |
| Ollama address |
http://localhost:11434 |
Local model server |
| Translation model |
translategemma:12b preferred |
Used by START |
| Glossary / Refinement |
First suitable instruct model |
Used by PREPARE / CONTINUE |
| Verifier |
Different from Refinement |
Checks proposed edits |
| Judge |
Different from Translation |
Optional diagnostics |
| Chunk size |
1200 characters |
Paragraphs first, then sentences |
| Genre |
Auto |
Fiction, Technical, Academic, Business, Poetry |
| Glossary verification |
Off |
Set OPENAI_API_KEY, ANTHROPIC_API_KEY, or GEMINI_API_KEY |
| COMET-Kiwi |
Off |
Set 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
Issues ·
Changelog ·
Contributing ·
Disclaimer ·
LinkedIn
评论