Translates English documents to Chinese with accurate semantics and grammar. Invoke when user asks to translate any English documentation or content to Chinese.
本技能专门用于将英语文档翻译成中文,确保语义和语法准确,适用于各类技术文档、用户手册、API文档等。
保持英文的技术术语:
可翻译的术语:
保持原样的内容:
def hello_world():
print("Hello, World!")
npm install react
{
"name": "my-app",
"version": "1.0.0"
}
可翻译的内容:
# Calculate the total price
def calculate_total(items):
return sum(item.price for item in items)
翻译为:
# 计算总价
def calculate_total(items):
return sum(item.price for item in items)
识别文档类型
理解文档结构
识别关键内容
按章节翻译
处理特殊元素
术语一致性检查
语义检查
语法检查
格式检查
术语检查
原文(英语):
# Getting Started
This guide will help you set up the development environment for the project.
## Prerequisites
Before you begin, make sure you have the following installed:
- Node.js 16 or higher
- npm 8 or higher
- Git
## Installation
1. Clone the repository:
```bash
git clone https://github.com/example/project.git
cd project
npm install
npm run dev
The application will be available at http://localhost:3000
**翻译后(中文):**
```markdown
# 快速开始
本指南将帮助您设置项目的开发环境。
## 前置要求
在开始之前,请确保已安装以下软件:
- Node.js 16 或更高版本
- npm 8 或更高版本
- Git
## 安装步骤
1. 克隆仓库:
```bash
git clone https://github.com/example/project.git
cd project
npm install
npm run dev
应用程序将在 http://localhost:3000 上运行
### 示例2:API文档
**原文(英语):**
```markdown
## User API
### Create User
Creates a new user account.
**Endpoint:** `POST /api/users`
**Request Body:**
```json
{
"username": "johndoe",
"email": "[email protected]",
"password": "securepassword123"
}
Response:
{
"id": 123,
"username": "johndoe",
"email": "[email protected]",
"createdAt": "2024-01-15T10:30:00Z"
}
**翻译后(中文):**
```markdown
## 用户 API
### 创建用户
创建新的用户账户。
**端点:** `POST /api/users`
**请求体:**
```json
{
"username": "johndoe",
"email": "[email protected]",
"password": "securepassword123"
}
响应:
{
"id": 123,
"username": "johndoe",
"email": "[email protected]",
"createdAt": "2024-01-15T10:30:00Z"
}
### 示例3:代码注释翻译
**原文(英语):**
```python
class UserService:
"""Service class for managing user operations."""
def __init__(self, db_connection):
"""Initialize the service with database connection."""
self.db = db_connection
def get_user(self, user_id):
"""Retrieve user by ID from the database.
Args:
user_id: The unique identifier of the user
Returns:
User object if found, None otherwise
"""
# Query the database for the user
query = "SELECT * FROM users WHERE id = %s"
result = self.db.execute(query, (user_id,))
return result.fetchone() if result else None
翻译后(中文):
class UserService:
"""用于管理用户操作的服务类。"""
def __init__(self, db_connection):
"""使用数据库连接初始化服务。"""
self.db = db_connection
def get_user(self, user_id):
"""从数据库中根据ID检索用户。
参数:
user_id: 用户的唯一标识符
返回:
如果找到则返回用户对象,否则返回None
"""
# 查询数据库获取用户信息
query = "SELECT * FROM users WHERE id = %s"
result = self.db.execute(query, (user_id,))
return result.fetchone() if result else None
技术术语
代码相关
命令和配置
文档结构
说明文字
代码注释(可选)
混合语言文档
不确定的术语
专有名词
缩写词
翻译完成后,应满足以下质量标准:
| 英文 | 中文 | 说明 |
|---|---|---|
| Authentication | 认证 | 验证用户身份 |
| Authorization | 授权 | 验证用户权限 |
| Deployment | 部署 | 将应用发布到生产环境 |
| Configuration | 配置 | 设置系统参数 |
| Installation | 安装 | 安装软件或依赖 |
| Setup | 设置 | 初始化配置 |
| Repository | 仓库 | 代码存储库 |
| Dependency | 依赖 | 项目所需的包或库 |
| Endpoint | 端点 | API的访问地址 |
| Payload | 负载 | 请求或响应的数据部分 |
| Middleware | 中间件 | 处理请求和响应的软件层 |
| Framework | 框架 | 提供基础结构的软件平台 |
| Library | 库 | 可重用的代码集合 |
| Component | 组件 | 可复用的UI或功能单元 |
| Service | 服务 | 提供特定功能的模块 |
| Interface | 接口 | 定义交互规范 |
| Implementation | 实现 | 接口的具体代码 |
| Instance | 实例 | 类的对象 |
| Method | 方法 | 类中的函数 |
| Property | 属性 | 对象的数据成员 |
| Parameter | 参数 | 函数或方法的输入 |
| Argument | 实参 | 调用时传递的具体值 |
| Variable | 变量 | 存储数据的标识符 |
| Constant | 常量 | 不可变的值 |
| Function | 函数 | 可执行的代码块 |
| Callback | 回调 | 作为参数传递的函数 |
| Promise | Promise | 异步操作的对象 |
| Async/Await | 异步/等待 | 处理异步操作的语法 |
| Event | 事件 | 系统或用户触发的动作 |
| Listener | 监听器 | 响应事件的函数 |
| Handler | 处理器 | 处理特定事件的函数 |
| Router | 路由器 | 管理URL路由的组件 |
| Controller | 控制器 | 处理请求的组件 |
| Model | 模型 | 数据结构和业务逻辑 |
| View | 视图 | 用户界面展示 |
| Template | 模板 | 可重用的页面结构 |
| Layout | 布局 | 页面的整体结构 |
| Style | 样式 | 视觉表现规则 |
| Theme | 主题 | 统一的视觉风格 |
| Plugin | 插件 | 扩展功能的模块 |
| Extension | 扩展 | 增强功能的组件 |
| Module | 模块 | 独立的功能单元 |
| Package | 包 | 代码的打包单位 |
| Bundle | 打包 | 将多个文件合并 |
| Build | 构建 | 编译和打包过程 |
| Compile | 编译 | 将源代码转换为可执行代码 |
| Debug | 调试 | 查找和修复错误 |
| Test | 测试 | 验证代码功能 |
| Release | 发布 | 发布新版本 |
| Version | 版本 | 软件的迭代标识 |
| Patch | 补丁 | 修复问题的更新 |
| Update | 更新 | 升级到新版本 |
| Upgrade | 升级 | 提升到更高版本 |
| Migration | 迁移 | 数据或系统的转移 |
| Backup | 备份 | 数据的副本 |
| Restore | 恢复 | 从备份恢复数据 |
| Log | 日志 | 系统运行记录 |
| Error | 错误 | 程序异常 |
| Exception | 异常 | 运行时错误 |
| Warning | 警告 | 潜在问题提示 |
| Info | 信息 | 一般性消息 |
| Debug | 调试 | 调试信息 |
| Trace | 跟踪 | 详细执行信息 |