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.
demo-readme.mp4
# 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.pyNo 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.
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 |
Upload → Prepare → Start → Continue → Review → Download
| Scans the entire book and proposes a glossary of characters, places, organisations, and terms. You approve it before anything is translated. | Translates in chunks with genre, glossary rules, and the previous paragraph as context. Finished sections appear while the rest keeps running. | 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.
Glossary that stays consistent
- Built from the full book, with
exact,inflectable, andpreferredrules 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
localhostwith SQLite - Local models keep the book on your computer. Ollama Cloud models (the
-cloudones) 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
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.
ru_RU |
es_ES |
fr_FR |
- Ollama on the same computer, Python 3.10+ (installed via
uvif missing), and enough memory and disk for your models - Minimum models:
translategemma:12bfor translation plusgemma4:31bfor the other roles - Author's stack (cloud open-source models): Glossary and Refinement
gemma4:31b-cloud, Translationtranslategemma:27b, Verifier and Judgemistral-large-4:cloud
- 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.
Issues · Changelog · Contributing · Disclaimer · LinkedIn