# gt: General Translation CLI tool: gt enqueue URL: https://generaltranslation.com/zh/docs/cli/reference/commands/enqueue.mdx --- title: gt enqueue description: 将已上传的文件加入 General Translation 队列而不下载结果。gt enqueue 命令的 API 参考。 --- 将之前上传的文件加入翻译队列后立即返回,不会等待处理完成或下载结果。可将其与 [`gt upload`](/docs/cli/reference/commands/upload) 和 [`gt download`](/docs/cli/reference/commands/download) 搭配使用,将翻译流程拆分到不同的 CI 阶段。请参阅[管理翻译](/docs/cli/guides/managing-translations#split)。 *注意:仅限生产环境使用。需要生产环境的 `GT_API_KEY` 和 `GT_PROJECT_ID`。* ```bash npx gt enqueue ``` ## 工作方式 [#how-it-works] 1. 读取 `gt.config.json`,确定要翻译哪些文件。 2. 通过内容哈希识别之前上传过的文件。 3. 将这些文件发送到 General Translation API 进行翻译。 4. 立即退出,不等待翻译完成。 要在结果就绪后下载,请运行 [`gt download`](/docs/cli/reference/commands/download)。 ## 选项 [#flags] `enqueue` 接受与 [`gt translate`](/docs/cli/reference/commands/translate#flags) 相同的选项。下面列出了最常用的几个;完整列表请参见上方链接的参考文档。 | 参数 | 描述 | 类型 | 可选 | 默认值 | | --------------------------- | --------------------------- | ---------- | -- | ---------------- | | `--api-key ` | 生产环境 API 密钥。 | `string` | 是 | `GT_API_KEY` | | `--project-id ` | 项目 ID。 | `string` | 是 | `GT_PROJECT_ID` | | `-c, --config ` | 配置文件的路径。 | `string` | 是 | `gt.config.json` | | `--locales ` | 额外的目标 locales,会追加到配置中的 locales。 | `string[]` | 是 | — | | `--default-locale ` | 项目的源 locales。 | `string` | 是 | `en` | | `--timeout ` | 请求超时时间 (秒) 。 | `number` | 是 | `900` | | `--dry-run` | 仅解析并验证,不调用 API。 | `boolean` | 是 | `false` | ## 示例 [#example] ```bash # 第一阶段:上传源文件 npx gt upload # 第二阶段:将已上传的文件加入翻译队列 npx gt enqueue # 第三阶段:结果就绪后下载 npx gt download ``` ## 其他说明 [#notes] 在 CI/CD 流水线中,如果每个步骤都在单独的阶段或作业中运行,把 `upload`、`enqueue` 和 `download` 拆开会很有用。由于 `enqueue` 会立即返回,因此下载步骤可以在翻译完成后放到后续作业中运行。