# gt: General Translation CLI tool: 加入队列 URL: https://generaltranslation.com/zh/docs/cli/enqueue.mdx --- title: 加入队列 description: 如何将翻译加入队列而无需下载 --- ## 用法 ```bash npx gt enqueue ``` **注意:** 此命令需要生产环境 API 密钥!请在 [平台](https://generaltranslation.com/dashboard) 上获取。 ## 概述 `gt enqueue` 命令会将之前已 upload 的文件加入翻译队列,**但不会等待结果,也不会下载结果**。 典型工作流如下: 1. [`gt upload`](/docs/cli/upload) — 将源文件 upload 到 General Translation 平台 2. **`gt enqueue`** — 将已 upload 的文件加入翻译队列 3. [`gt download`](/docs/cli/download) — 下载已完成的翻译 这种拆分方式在 CI/CD 流水线中特别有用,因为每个步骤都可能位于不同的阶段或作业中。 **仅限生产环境使用!** 此命令用于生产构建,**不应在开发环境中使用**。 请务必在环境变量中指定生产环境的 API 密钥 (`GT_API_KEY`) 和项目 ID (`GT_PROJECT_ID`) 。 ## 工作原理 1. 读取 `gt.config.json`,确定要翻译哪些文件 2. 根据内容哈希识别此前已 upload 的文件 3. 将它们发送到 General Translation API 进行翻译 4. 立即退出——**不会**等待翻译完成 翻译就绪后,如需下载译文,请运行 [`gt download`](/docs/cli/download)。 ## 标志 `enqueue` 命令使用与 [`translate`](/docs/cli/translate#flags) 相同的标志。 | 参数 | 说明 | 类型 | 可选 | 默认值 | | ----------------- | ------------------- | -------- | ------ | ------------------ | | `--api-key` | 指定生产环境 API 密钥 | `string` | `true` | | | `--project-id` | 指定项目 ID | `string` | `true` | | | `--version-id` | 指定版本 ID (默认是内容的哈希值) | `string` | `true` | | | `--config ` | 指定 GT 配置文件路径 | `string` | `true` | `"gt.config.json"` | | `--timeout` | 请求超时时间 (秒) | `number` | `true` | `900` | | `--new, --locales ` | 项目要翻译到的目标区域设置 | `[string]` | `true` | | | `--default-locale ` | 项目的源区域设置 | `string` | `true` | `en` | | `--dry-run` | 试运行该命令 | `flag` | `true` | `false` | ## 示例:拆分 CI 流水线 ```bash # 阶段 1:上传源文件 npx gt upload # 阶段 2:将翻译加入队列 npx gt enqueue # 阶段 3:准备就绪后下载 npx gt download ```