xunbu/docutranslate
文档(小说、论文、字幕)翻译工具(支持 pdf/word/excel/json/epub/srt...)Document (Novel, Thesis, Subtitle) Translation Tool (Supports pdf/word/excel/json/epub/srt...)
DocuTranslate – Local LLM‑powered document translation
What it does – DocuTranslate is a Python‑based tool that lets you translate a wide range of file types (PDF, DOCX, XLSX, MD, TXT, JSON, EPUB, SRT, ASS, …) on your own machine using large language models (LLMs). It parses the source document, breaks the text into chunks, sends those chunks to an LLM‑based translation service, then re‑assembles the result while trying to keep the original layout and formatting.
Key features
- Multi‑format support – Handles both plain‑text and rich formats; DOCX/XLSX output preserves styling.
- PDF handling – Uses the MinerU engine (online or self‑hosted) to extract tables, formulas and code, converting the PDF first to markdown (layout may be lost).
- Glossary – Optional auto‑generated glossary to keep terminology consistent.
- Async & concurrent – Built with asyncio; you can run many translation requests in parallel (default 10 concurrent LLM calls).
- LAN / multi‑user – A single instance can serve several users on a local network via a web UI or REST API.
- MCP server – Exposes a Model Context Protocol (MCP) endpoint for other tools to stream translation jobs.
- Portable binaries – Windows and macOS packages under 40 MB.
How you use it
- Install –
pip install docutranslate(optional[mcp]extra) or pull the Docker image. - Configure – Set environment variables for your LLM provider (
DOCUTRANSLATE_API_KEY,BASE_URL,MODEL_ID, etc.). - Run –
docutranslate -istarts the web UI; add--host 0.0.0.0to expose it on the LAN. - Translate – Upload a file via the UI or call the REST API (
/translate). You can also use the Python SDK:from docutranslate.sdk import Client client = Client(api_key='...', base_url='https://api.openai.com/v1', model_id='gpt-4o') result = client.translate('paper.pdf', convert_engine='mineru', mineru_token='...') result.save(fmt='html') - Advanced – Use the lower‑level Workflow classes for fine‑grained control (custom chunk size, insertion mode, JSONPath selection, etc.).
Typical workflow
- Detect file type → choose appropriate Workflow → optional PDF → markdown conversion → split into chunks → send each chunk to the LLM → collect translated chunks → rebuild document in the original format (or export as HTML/markdown/base64).
Supported LLM providers – Any service that follows the standard OpenAI‑compatible API (OpenAI, Azure, Zhipu, etc.). The provider field can be set to auto or a specific name.
Limitations
- PDF conversion to markdown discards exact page layout.
- No native support for legacy
.docor.xlsfiles. - Glossary generation is optional and may require extra LLM calls.
Who might need it – Researchers translating academic papers, writers localising novels, teams that need bulk translation of internal documents without sending data to third‑party SaaS platforms.
Resources – GitHub releases contain ready‑to‑run packages; the README links to MCP documentation, Docker usage, and a QQ community for support.
Related
- Project
- Project
- Project
- Project
- Project