能力标签
🛠
AI工具

DocuTranslate文档翻译器

基于 Python · 开源免费,本地部署,数据完全自主可控
英文名:docutranslate
⭐ 1.1k Stars 🍴 159 Forks 💻 Python 📄 MPL-2.0 🏷 AI 7.8分
7.8AI 综合评分
文档翻译PDF处理LLM应用格式转换开源工具
✦ AI Skill Hub 推荐

AI Skill Hub 推荐使用:DocuTranslate文档翻译器 是一款优质的AI工具。已获得 1.1k 颗 GitHub Star,AI 综合评分 7.8 分,在同类工具中表现稳健。如果你正在寻找可靠的AI工具解决方案,这是一个值得深入了解的选择。

📚 深度解析
DocuTranslate文档翻译器 是一款基于 Python 的开源工具,在 GitHub 上收获 1k+ Star,是文档翻译、PDF处理、LLM应用、格式转换领域中的优质开源项目。开源工具的最大优势在于代码完全透明,你可以审计每一行代码的安全性,也可以根据自身需求进行二次开发和定制。

**为什么要使用开源工具而非商业 SaaS?**
对于个人开发者和有隐私需求的用户,本地部署的开源工具意味着数据不离本机,不受第三方服务商的数据政策约束。同时,开源工具通常没有使用次数限制和月度费用,一次安装即可长期使用,对于高频使用场景的总拥有成本(TCO)远低于订阅制商业工具。

**安装与环境准备**
DocuTranslate文档翻译器 依赖 Python 运行环境。建议通过 pyenv(Python)或 nvm(Node.js)管理 Python 版本,避免全局环境污染。对于新手用户,推荐先创建虚拟环境(python -m venv venv && source venv/bin/activate),再安装依赖,这样即使出现问题也可以随时删除虚拟环境重新开始,不影响系统稳定性。

**社区与维护**
GitHub Issue 和 Discussion 是获取帮助的最快渠道。在提问前建议先检查 Closed Issues(已关闭的问题),大多数常见问题都已有解答。遇到 Bug 时,提供 pip list 的输出、完整错误堆栈和最小可复现示例,能显著提高开发者响应速度。AI Skill Hub 将持续追踪 DocuTranslate文档翻译器 的版本更新,及时通知重要功能变化。
📋 工具概览

DocuTranslate文档翻译器 是一款基于 Python 开发的开源工具,专注于 文档翻译、PDF处理、LLM应用 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

GitHub Stars
⭐ 1.1k
开发语言
Python
支持平台
Windows / macOS / Linux
维护状态
正常维护,社区驱动
开源协议
MPL-2.0
AI 综合评分
7.8 分
工具类型
AI工具
Forks
159
📖 中文文档
以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

DocuTranslate文档翻译器 是一款基于 Python 开发的开源工具,专注于 文档翻译、PDF处理、LLM应用 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

📌 核心特色
  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
🎯 主要使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:pip 安装(推荐)
pip install docutranslate

# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install docutranslate

# 方式三:从源码安装(获取最新功能)
git clone https://github.com/xunbu/docutranslate
cd docutranslate
pip install -e .

# 验证安装
python -c "import docutranslate; print('安装成功')"
📋 安装步骤说明
  1. 访问 GitHub 仓库页面
  2. 按照 README 文档完成依赖安装
  3. 根据系统环境完成初始化配置
  4. 参考官方示例或文档开始使用
  5. 遇到问题可在 GitHub Issues 中查找解答
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 命令行使用
docutranslate --help

# 基本用法
docutranslate input_file -o output_file

# Python 代码中调用
import docutranslate

# 示例
result = docutranslate.process("input")
print(result)
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
# docutranslate 配置文件示例(config.yml)
app:
  name: "docutranslate"
  debug: false
  log_level: "INFO"

# 运行时指定配置文件
docutranslate --config config.yml

# 或通过环境变量配置
export DOCUTRANSLATE_API_KEY="your-key"
export DOCUTRANSLATE_OUTPUT_DIR="./output"
📑 README 深度解析 真实文档 完整度 78/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

<p align="center"> <img src="./DocuTranslate.png" alt="Project Logo" style="width: 150px"> </p>

DocuTranslate

<p align="center"> <a href="https://github.com/xunbu/docutranslate/stargazers"><img src="https://img.shields.io/github/stars/xunbu/docutranslate?style=flat-square&logo=github&color=blue" alt="GitHub stars"></a> <a href="https://github.com/xunbu/docutranslate/releases"><img src="https://img.shields.io/github/downloads/xunbu/docutranslate/total?logo=github&style=flat-square" alt="GitHub Downloads"></a> <a href="https://pypi.org/project/docutranslate/"><img src="https://img.shields.io/pypi/v/docutranslate?style=flat-square" alt="PyPI version"></a> <a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.11+-3776AB?logo=python&logoColor=white&style=flat-square" alt="Python Version"></a> <a href="./LICENSE"><img src="https://img.shields.io/github/license/xunbu/docutranslate?style=flat-square" alt="License"></a> </p>

<p align="center"> <a href="/README_ZH.md"><strong>简体中文</strong></a> / <a href="/README.md"><strong>English</strong></a> / <a href="/README_JP.md"><strong>日本語</strong></a> / <a href="/README_VI.md"><strong>Tiếng Việt</strong></a> </p>

<p align="center"> A lightweight local file translation tool based on Large Language Models. </p>

  • Support Multiple Formats: Translates pdf, docx, xlsx, md, txt, json, epub, srt, ass, and more.
  • Auto-Generate Glossary: Supports automatic glossary generation to ensure term alignment.
  • PDF Table, Formula, Code Recognition: Uses mineru (online or locally deployed) for PDF parsing, supporting recognition and translation of tables, formulas, and code commonly found in academic papers.
  • JSON Translation: Supports specifying values to translate within JSON using paths (jsonpath-ng syntax).
  • Word/Excel Format Preservation: Supports docx and xlsx files (currently does not support doc or xls) while maintaining original formatting.
  • Multi-AI Platform Support: Supports most AI platforms, allowing for high-performance concurrent AI translation with custom prompts.
  • Async Support: Designed for high-performance scenarios, providing full asynchronous support and interfaces for parallel multi-tasking.
  • LAN & Multi-user Support: Supports simultaneous use by multiple users within a local area network (LAN).
  • Interactive Web Interface: Provides an out-of-the-box Web UI and RESTful API for easy integration and usage.
  • Compact, Portable Packages: Windows and Mac portable packages under 40MB.
When translating pdf, it is first converted to markdown. This will lose the original layout. Users with strict layout requirements should take note.
QQ Community Group: 1047781902 1081128602

UI Interface: UI Interface

Paper Translation: Paper Translation

Novel Translation: Novel Translation

Example 2: Translate PDF files (requires mineru_token or local deployment)

Prerequisites and Detailed Configuration

Basic installation

pip install docutranslate

Install mcp extension

pip install docutranslate[mcp]

docutranslate -i

#docutranslate -i --with-mcp ```

Basic installation

uv add docutranslate

Install mcp extension

uv add docutranslate[mcp]

uv run --no-dev docutranslate -i

#uv run --no-dev docutranslate -i --with-mcp ```

Using docker

```bash docker run -d -p 8010:8010 xunbu/docutranslate:latest

docker run -it -p 8010:8010 xunbu/docutranslate:latest

docker run -it -p 8010:8010 xunbu/docutranslate:v1.5.4

```

uvx Configuration (No Installation Required)

{
  "mcpServers": {
    "docutranslate": {
      "command": "uvx",
      "args": ["--from", "docutranslate[mcp]", "docutranslate", "--mcp"],
      "env": {
        "DOCUTRANSLATE_API_KEY": "sk-xxxxxx",
        "DOCUTRANSLATE_BASE_URL": "https://api.openai.com/v1",
        "DOCUTRANSLATE_MODEL_ID": "gpt-4o",
        "DOCUTRANSLATE_TO_LANG": "Chinese",
        "DOCUTRANSLATE_CONCURRENT": "10",
        "DOCUTRANSLATE_CONVERT_ENGINE": "mineru",
        "DOCUTRANSLATE_MINERU_TOKEN": "your-mineru-token"
      }
    }
  }
}

2.2. Locally Deployed MinerU Service

For offline/intranet environments, you can use locally deployed minerU. Set mineru_deploy_base_url to your minerU API endpoint.

Client SDK:

from docutranslate.sdk import Client

client = Client(
    api_key="YOUR_LLM_API_KEY",
    model_id="llama3",
    to_lang="Chinese",
    convert_engine="mineru_deploy",
    mineru_deploy_base_url="http://127.0.0.1:8000",  # Your minerU API address
)
result = client.translate("document.pdf")
result.save(fmt="markdown")

Quick Start

Usage Examples

Example 1: Translate plain text files (no PDF parsing engine needed)

result = client.translate("path/to/your/document.txt") print(f"Translation complete! Saved to: {result.save()}")

Example 3: Translate Docx files (preserve formatting)

result = client.translate( "path/to/your/document.docx", insert_mode="replace", # replace/append/prepend ) result.save(fmt="docx") # Save as docx format

Example 4: Export as base64 encoded string (for API transmission)

base64_content = result.export(fmt="html") print(f"Exported content length: {len(base64_content)}")

Initialize environment

uv init

Initialize environment

git clone https://github.com/xunbu/docutranslate.git

cd docutranslate

uv sync --no-dev

MCP Configuration

DocuTranslate can be used as an MCP (Model Context Protocol) server. For detailed documentation, see MCP Documentation.

Supported Environment Variables

Environment VariableDescriptionRequired
DOCUTRANSLATE_API_KEYAI platform API keyYes
DOCUTRANSLATE_BASE_URLAI platform base URLYes
DOCUTRANSLATE_MODEL_IDModel IDYes
DOCUTRANSLATE_TO_LANGTarget language (default: Chinese)No
DOCUTRANSLATE_CONCURRENTConcurrent requests (default: 10)No
DOCUTRANSLATE_CONVERT_ENGINEPDF conversion engineNo
DOCUTRANSLATE_MINERU_TOKENMinerU API TokenNo

SSE Mode Configuration

First start the MCP server in SSE mode:

docutranslate --mcp --transport sse --mcp-host 127.0.0.1 --mcp-port 8000

Then configure the SSE endpoint in your client: http://127.0.0.1:8000/mcp/sse

Initialize the client with your AI platform settings

client = Client( api_key="YOUR_OPENAI_API_KEY", # or any other AI platform API key base_url="https://api.openai.com/v1/", model_id="gpt-4o", to_lang="Chinese", concurrent=10, # Number of concurrent requests )

Option A: Use online MinerU (token required: https://mineru.net/apiManage/token)

result = client.translate( "path/to/your/document.pdf", convert_engine="mineru", mineru_token="YOUR_MINERU_TOKEN", # Replace with your MinerU Token formula_ocr=True, # Enable formula recognition ) result.save(fmt="html")

1. Create TranslatorConfig (LLM settings)

2. Create WorkflowConfig (workflow settings)

TXT: from docutranslate.workflow.txt_workflow import TXTWorkflow, TXTWorkflowConfig

JSON: from docutranslate.workflow.json_workflow import JsonWorkflow, JsonWorkflowConfig

DOCX: from docutranslate.workflow.docx_workflow import DocxWorkflow, DocxWorkflowConfig

XLSX: from docutranslate.workflow.xlsx_workflow import XlsxWorkflow, XlsxWorkflowConfig

EPUB: from docutranslate.workflow.epub_workflow import EpubWorkflow, EpubWorkflowConfig

HTML: from docutranslate.workflow.html_workflow import HtmlWorkflow, HtmlWorkflowConfig

SRT: from docutranslate.workflow.srt_workflow import SrtWorkflow, SrtWorkflowConfig

ASS: from docutranslate.workflow.ass_workflow import AssWorkflow, AssWorkflowConfig

```

Key config options: - insert_mode: "replace", "append", or "prepend" (for docx/xlsx/html/epub) - json_paths: JSONPath expressions for JSON translation (e.g., ["$.*", "$.name"]) - separator: Text separator for "append" / "prepend" modes

Start Web UI and API Service

For ease of use, DocuTranslate provides a fully functional Web Interface and RESTful API.

Start the Service:

  docutranslate -i                           (Start GUI, default local access)
  docutranslate -i --host 0.0.0.0            (Allow access from other devices on LAN)
  docutranslate -i -p 8081                   (Specify port number)
  docutranslate -i --cors                    (Enable default CORS settings)
  docutranslate -i --with-mcp                (Start GUI with MCP SSE endpoint, shared queue, shared port)
  docutranslate --mcp                         (Start MCP server, stdio mode)
  docutranslate --mcp --transport sse         (Start MCP server, SSE mode)
  docutranslate --mcp --transport sse --mcp-host MCP_HOST   --mcp-port MCP_PORT  (Start MCP server, SSE mode)
  docutranslate --mcp --transport streamable-http  (Start MCP server, Streamable HTTP mode)
  • Interactive Interface: After starting the service, please visit http://127.0.0.1:8010 (or your specified port) in your browser.
  • API Documentation: Full API documentation (Swagger UI) is located at http://127.0.0.1:8010/docs.
  • MCP: SSE service endpoint is at http://127.0.0.1:8010/mcp/sse (started with --with-mcp) or http://127.0.0.1:8000/mcp/sse (started with --mcp)

First start local MinerU service, reference: https://github.com/opendatalab/MinerU

result = client.translate( "path/to/your/document.pdf", convert_engine="mineru_deploy", mineru_deploy_base_url="http://127.0.0.1:8000", # Your local MinerU address mineru_deploy_backend="hybrid-auto-engine", # Backend type ) result.save(fmt="markdown")

Using Workflow API (For Advanced Control)

For more control, use the Workflow API directly. Each workflow follows the same pattern:

```python

1. Get Large Model API Key

Translation functionality relies on Large Language Models. You need to obtain a base_url, api_key, and model_id from the corresponding AI platform.

Recommended Models: Volcengine's doubao-seed-1-6-flash, doubao-seed-1-6 series, Zhipu's glm-4-flash, Alibaba Cloud's qwen-plus, qwen-flash, Deepseek's deepseek-chat, etc.
302.AI 👈 Register via this link to get $1 free credit.
Platform NameGet API KeyBase URL
ollamahttp://127.0.0.1:11434/v1
lm studiohttp://127.0.0.1:1234/v1
302.AI[Click to Get](https://share.302.ai/BgRLAe)https://api.302.ai/v1
openrouter[Click to Get](https://openrouter.ai/settings/keys)https://openrouter.ai/api/v1
openai[Click to Get](https://platform.openai.com/api-keys)https://api.openai.com/v1/
gemini[Click to Get](https://aistudio.google.com/u/0/apikey)https://generativelanguage.googleapis.com/v1beta/openai/
deepseek[Click to Get](https://platform.deepseek.com/api_keys)https://api.deepseek.com/v1
Zhipu AI[Click to Get](https://open.bigmodel.cn/usercenter/apikeys)https://open.bigmodel.cn/api/paas/v4
Tencent Hunyuan[Click to Get](https://console.cloud.tencent.com/hunyuan/api-key)https://api.hunyuan.cloud.tencent.com/v1
Alibaba Bailian[Click to Get](https://bailian.console.aliyun.com/?tab=model#/api-key)https://dashscope.aliyuncs.com/compatible-mode/v1
Volcengine[Click to Get](https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D)https://ark.cn-beijing.volces.com/api/v3
SiliconFlow[Click to Get](https://cloud.siliconflow.cn/account/ak)https://api.siliconflow.cn/v1
DMXAPI[Click to Get](https://www.dmxapi.cn/token)https://www.dmxapi.cn/v1
Juguang AI[Click to Get](https://ai.juguang.chat/console/token)https://ai.juguang.chat/v1

Integration Packages

For users who want to get started quickly, we provide integration packages on GitHub Releases. Simply download, unzip, and enter your AI platform API-Key to start using it.

You can also access the underlying workflow for advanced operations

workflow = result.workflow


**Client Features:**
- **Auto-detection**: Automatically detects file type and selects the appropriate workflow
- **Flexible Configuration**: Override any default settings per translation call
- **Multiple Output Options**: Save to disk or export as Base64 string
- **Async Support**: Use `translate_async()` for concurrent translation tasks

#### Client SDK Parameters

| Parameter | Type | Default | Description |
|:---|:---|:---|:---|
| **api_key** | `str` | - | AI platform API key |
| **base_url** | `str` | - | AI platform base URL (e.g., `https://api.openai.com/v1/`) |
| **model_id** | `str` | - | Model ID to use for translation |
| **to_lang** | `str` | - | Target language (e.g., `"Chinese"`, `"English"`, `"Japanese"`) |
| **concurrent** | `int` | 10 | Number of concurrent LLM requests |
| **convert_engine** | `str` | `"mineru"` | PDF parsing engine: `"mineru"`, `"mineru_deploy"` |
| **md2docx_engine** | `str` | `"auto"` | Markdown to Docx engine: `"python"` (pure Python), `"pandoc"` (use Pandoc), `"auto"` (use Pandoc if installed, otherwise Python), `null` (do not generate docx) |
| **mineru_deploy_base_url** | `str` | - | Local minerU API address (when `convert_engine="mineru_deploy"`) |
| **mineru_deploy_parse_method** | `str` | `"auto"` | Local minerU parsing method: `"auto"`, `"txt"`, `"ocr"` |
| **mineru_deploy_table_enable** | `bool` | `True` | Enable table recognition for local minerU |
| **mineru_token** | `str` | - | minerU API token (when using online minerU) |
| **skip_translate** | `bool` | `False` | Skip translation, only parse document |
| **output_dir** | `str` | `"./output"` | Default output directory for `save()` |
| **chunk_size** | `int` | 3000 | Text chunk size for LLM processing |
| **temperature** | `float` | 0.3 | LLM temperature parameter |
| **timeout** | `int` | 60 | Request timeout in seconds |
| **retry** | `int` | 3 | Number of retry attempts on failure |
| **provider** | `str` | `"auto"` | AI provider type (auto, openai, azure, etc.) |
| **force_json** | `bool` | `False` | Force JSON output mode |
| **rpm** | `int` | - | Requests per minute limit |
| **tpm** | `int` | - | Tokens per minute limit |
| **extra_body** | `str` | - | Additional request body parameters in JSON string format, will be merged into API request |
| **thinking** | `str` | `"auto"` | Thinking mode: `"auto"`, `"none"`, `"block"` |
| **custom_prompt** | `str` | - | Custom prompt for translation |
| **system_proxy_enable** | `bool` | `False` | Enable system proxy |
| **insert_mode** | `str` | `"replace"` | Docx/Xlsx/Txt insertion mode: `"replace"`, `"append"`, `"prepend"` |
| **separator** | `str` | `"\n"` | Text separator for append/prepend modes |
| **segment_mode** | `str` | `"line"` | Segmentation mode: `"line"`, `"paragraph"`, `"none"` |
| **translate_regions** | `list` | - | Excel translation regions (e.g., `"Sheet1!A1:B10"`) |
| **model_version** | `str` | `"vlm"` | MinerU model version: `"pipeline"`, `"vlm"` |
| **formula_ocr** | `bool` | `True` | Enable formula OCR for PDF parsing |
| **code_ocr** | `bool` | `True` | Enable code OCR for PDF parsing |
| **mineru_deploy_backend** | `str` | `"hybrid-auto-engine"` | MinerU local backend: `"pipeline"`, `"vlm-auto-engine"`, `"vlm-http-client"`, `"hybrid-auto-engine"`, `"hybrid-http-client"` |
| **mineru_deploy_formula_enable** | `bool` | `True` | Enable formula recognition for local MinerU |
| **mineru_deploy_start_page_id** | `int` | 0 | Start page ID for local MinerU parsing |
| **mineru_deploy_end_page_id** | `int` | 99999 | End page ID for local MinerU parsing |
| **mineru_deploy_lang_list** | `list` | - | Language list for local MinerU parsing |
| **mineru_deploy_server_url** | `str` | - | MinerU local server URL |
| **json_paths** | `list` | - | JSONPath expressions for JSON translation (e.g., `"$.data.*"`) |
| **glossary_generate_enable** | `bool` | - | Enable auto glossary generation |
| **glossary_dict** | `dict` | - | Glossary dictionary (e.g., `{"Jobs": "Steve Jobs"}`) |
| **glossary_agent_config** | `dict` | - | Glossary agent configuration |

#### Result Methods

| Method | Parameters | Description |
|:---|:---|:---|
| **save()** | `output_dir`, `name`, `fmt` | Save translation result to disk |
| **export()** | `fmt` | Export as Base64 encoded string |
| **supported_formats** | - | Get list of supported output formats |
| **workflow** | - | Access underlying workflow object |
python import asyncio from docutranslate.sdk import Client

async def translate_multiple(): client = Client( api_key="YOUR_API_KEY", base_url="https://api.openai.com/v1/", model_id="gpt-4o", to_lang="Chinese", )

# Translate multiple files concurrently files = ["doc1.pdf", "doc2.docx", "notes.txt"] results = await asyncio.gather( *[client.translate_async(f) for f in files] )

for r in results: print(f"Saved: {r.save()}")

asyncio.run(translate_multiple()) ```

3. Create Workflow instance

4. workflow.read_path(file)

5. await workflow.translate_async()

6. workflow.save_as_*(name=...) or export_to_*(...)

#### Available Workflows and Output Methods

| Workflow | Inputs | save_as_* | export_to_* | Key Config Options |
|:---|:---|:---|:---|:---|
| **MarkdownBasedWorkflow** | `.pdf`, `.docx`, `.md`, `.png`, `.jpg` | `html`, `markdown`, `markdown_zip`, `docx` | `html`, `markdown`, `markdown_zip`, `docx` | `convert_engine`, `md2docx_engine`, `translator_config` |
| **TXTWorkflow** | `.txt` | `txt`, `html` | `txt`, `html` | `translator_config` |
| **JsonWorkflow** | `.json` | `json`, `html` | `json`, `html` | `translator_config`, `json_paths` |
| **DocxWorkflow** | `.docx` | `docx`, `html` | `docx`, `html` | `translator_config`, `insert_mode` |
| **XlsxWorkflow** | `.xlsx`, `.csv` | `xlsx`, `html` | `xlsx`, `html` | `translator_config`, `insert_mode` |
| **SrtWorkflow** | `.srt` | `srt`, `html` | `srt`, `html` | `translator_config` |
| **EpubWorkflow** | `.epub` | `epub`, `html` | `epub`, `html` | `translator_config`, `insert_mode` |
| **HtmlWorkflow** | `.html`, `.htm` | `html` | `html` | `translator_config`, `insert_mode` |
| **AssWorkflow** | `.ass` | `ass`, `html` | `ass`, `html` | `translator_config` |

#### Key Configuration Options

**Common TranslatorConfig Options:**

| Option | Type | Default | Description |
|:---|:---|:---|:---|
| `base_url` | `str` | - | AI platform base URL |
| `api_key` | `str` | - | AI platform API key |
| `model_id` | `str` | - | Model ID |
| `to_lang` | `str` | - | Target language |
| `chunk_size` | `int` | 3000 | Text chunk size |
| `concurrent` | `int` | 10 | Concurrent requests |
| `temperature` | `float` | 0.3 | LLM temperature |
| `timeout` | `int` | 60 | Request timeout (seconds) |
| `retry` | `int` | 3 | Retry attempts |

**Format-Specific Options:**

| Option | Applicable Workflows | Description |
|:---|:---|:---|
| `insert_mode` | Docx, Xlsx, Html, Epub | `"replace"` (default), `"append"`, `"prepend"` |
| `json_paths` | Json | JSONPath expressions (e.g., `["$.*", "$.name"]`) |
| `separator` | Docx, Xlsx, Html, Epub | Text separator for append/prepend modes |
| `convert_engine` | MarkdownBased | `"mineru"` (default), `"mineru_deploy"` |

#### Example 1: Translate a PDF File (Using `MarkdownBasedWorkflow`)

This is the most common use case. We will use the `minerU` engine to convert the PDF to Markdown, and then translate it using an LLM. This example uses asynchronous execution.
python import asyncio from docutranslate.workflow.md_based_workflow import MarkdownBasedWorkflow, MarkdownBasedWorkflowConfig from docutranslate.converter.x2md.converter_mineru import ConverterMineruConfig from docutranslate.translator.ai_translator.md_translator import MDTranslatorConfig from docutranslate.exporter.md.md2html_exporter import MD2HTMLExporterConfig

async def main(): # 1. Build Translator Configuration translator_config = MDTranslatorConfig( base_url="https://open.bigmodel.cn/api/paas/v4", # AI Platform Base URL api_key="YOUR_ZHIPU_API_KEY", # AI Platform API Key model_id="glm-4-air", # Model ID to_lang="English", # Target Language chunk_size=3000, # Text chunk size concurrent=10, # Concurrency level # glossary_generate_enable=True, # Enable auto-glossary generation # glossary_dict={"Jobs":"Steve Jobs"}, # Pass in a glossary dictionary # system_proxy_enable=True, # Enable system proxy )

# 2. Build Converter Configuration (Using minerU) converter_config = ConverterMineruConfig( mineru_token="YOUR_MINERU_TOKEN", # Your minerU Token formula_ocr=True # Enable formula recognition )

# 3. Build Main Workflow Configuration workflow_config = MarkdownBasedWorkflowConfig( convert_engine="mineru", # Specify parsing engine converter_config=converter_config, # Pass converter config translator_config=translator_config, # Pass translator config html_exporter_config=MD2HTMLExporterConfig(cdn=True) # HTML export config )

# 4. Instantiate Workflow workflow = MarkdownBasedWorkflow(config=workflow_config)

# 5. Read file and execute translation print("Starting to read and translate file...") workflow.read_path("path/to/your/document.pdf") await workflow.translate_async() # Or use synchronous method # workflow.translate() print("Translation complete!")

# 6. Save results workflow.save_as_html(name="translated_document.html") workflow.save_as_markdown_zip(name="translated_document.zip") workflow.save_as_markdown(name="translated_document.md") # Markdown with embedded images print("Files saved to ./output folder.")

# Or get content strings directly html_content = workflow.export_to_html() html_content = workflow.export_to_markdown() # print(html_content)

if name == "main": asyncio.run(main()) ```

Other Workflows

All workflows follow the same pattern. Import the corresponding config and workflow, then configure:

```python

FAQ

Q: Output is in original language? A: Check logs for errors. Usually due to exhausted API credits or network issues.

Q: Port 8010 occupied? A: Use docutranslate -i -p 8011 or set DOCUTRANSLATE_PORT=8011.

Q: Scanned PDFs supported? A: Yes, use mineru engine with OCR capabilities.

Q: Use in intranet/offline? A: Yes. Local translation can be achieved by deploying a local LLM (Ollama/LM Studio/VLLM, etc.). If you need to parse PDFs locally, you also need to deploy MinerU locally.

Q: PDF cache mechanism? A: MarkdownBasedWorkflow caches parsing results in memory (last 10 parses). Configure via DOCUTRANSLATE_CACHE_NUM.

Q: Enable proxy? A: Set system_proxy_enable=True in TranslatorConfig.

🎯 aiskill88 AI 点评 A 级 2026-05-24

功能完整覆盖多格式文档翻译需求,社区活跃度适中。格式兼容性强,架构清晰,对批量翻译需求支持良好,是实用的生产级工具。

⚡ 核心功能
👥 适合人群
AI 技术爱好者研究人员和学生开发者和工程师技术创业者
🎯 使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
⚖️ 优点与不足
✅ 优点
  • +MPL-2.0 协议,可免费商用
  • +完全开源免费,无授权费用
  • +本地部署,数据完全自主可控
  • +开发者社区支持,遇问题可查可问
⚠️ 不足
  • 安装和初始配置可能需要一定技术基础
  • 功能完整性通常不如成熟商业产品
  • 技术支持主要依赖开源社区,响应速度不稳定
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ MPL 2.0 — 文件级 Copyleft,修改的文件需开源,但可与闭源代码结合使用。

🔗 相关工具推荐
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合
❓ 常见问题 FAQ
Check logs for errors. Usually due to exhausted API credits or network issues.
💡 AI Skill Hub 点评

总体来看,DocuTranslate文档翻译器 是一款质量良好的AI工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。

📚 深入学习 DocuTranslate文档翻译器
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 docutranslate
Topics 文档翻译PDF处理LLM应用格式转换开源工具
GitHub https://github.com/xunbu/docutranslate
License MPL-2.0
语言 Python
🔗 原始来源
🐙 GitHub 仓库  https://github.com/xunbu/docutranslate

收录时间:2026-05-24 · 更新时间:2026-05-24 · License:MPL-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。