# General Translation Changelog: generaltranslation 8.0.0: 分支与 API 弃用
URL: https://generaltranslation.com/zh/blog/generaltranslation_v8.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 
Authors: Brian Lou
Published: 2025-11-10

## 概述

在 **generaltranslation v8** 中，我们对 API 进行了重大调整，并弃用了部分 API 函数和端点。

**<u>旧版 API 将不再受支持。</u>**

`generaltranslation` 版本低于 `7.5` 时，很可能会报错。
`gtx-cli` 版本低于 `2.1.5` 时，很可能会报错。

***

## 背景

为提升开发者体验、便于后续开发并简化翻译管理，我们引入了分支功能，并弃用了一些已不再使用的 API 端点。

***

## 功能

最新的 API 函数现已支持分支，你可以为项目的不同分支创建不同的翻译。

现在，每个文件都会关联到一个分支。文件版本现在由 `branchId`、`fileId` 和 `versionId` 决定。

此前，文件翻译只会关联到单个分支。
缓存的文件翻译默认使用该文件最近更新的版本。

在版本 8 中，更新文件翻译时将使用指定分支上该文件的最新版本。
版本控制现在基于分支历史，而不是时间戳。

新的版本控制系统沿用了 Git 的分支模型：

* 在某个分支上更新源文件会创建该文件的新版本。
* 将某个分支合并到 main 时，会在 main 分支上的源文件与被合并分支上的源文件之间建立关联。
  * 后续翻译会同时纳入这两个分支中的翻译。
* 检出某个分支会创建该文件的新版本
  * 该分支上的翻译会引用 main 分支中之前的翻译。

要启用此功能，请在最新版 gtx-cli 的 `gtx-cli translate` 命令中添加 `--enable-branching` 标志。

默认情况下，分支功能处于禁用状态，所有项目文件都会关联到 main 分支。

要使用此功能，你的组织必须使用付费套餐。

## 变更

### `generaltranslation`

* 已弃用 `checkTranslationStatus`
* 已弃用 [`downloadFile`](/docs/platform/core/reference/gt-class-methods/translation/download-file)
* 将 `downloadTranslatedFile` 重命名为 [`downloadFile`](/docs/platform/core/reference/gt-class-methods/translation/download-file)
  * 是否指定区域设置将决定下载源文件还是对应的翻译
* 修改了 [`downloadFile`](/docs/platform/core/reference/gt-class-methods/translation/download-file) 和 [`downloadFileBatch`](/docs/platform/core/reference/gt-class-methods/translation/download-file-batch) 的参数
* 已弃用 `enqueueEntries`
* 修改了 [`enqueueFiles`](/docs/platform/core/reference/gt-class-methods/translation/enqueue-files) 的参数 (新增 branchIds) 
* 已弃用 `fetchTranslations`
* 已弃用 `shouldSetupProject`
* 修改了 `submitUserEditDiffs` 的参数 (新增 branchIds，并将 id 字段设为必填) 
* 修改了 [`uploadSourceFiles`](/docs/platform/core/reference/gt-class-methods/translation/upload-source-files) 的参数 (新增 branchIds) 
* 修改了 [`uploadTranslations`](/docs/platform/core/reference/gt-class-methods/translation/upload-translations) 的参数 (新增 branchIds) 
* 修改了 [`querySourceFile`](/docs/platform/core/reference/gt-class-methods/translation/query-source-file) 的参数 (新增 branchIds) 
* 新增了 [`checkJobStatus`](/docs/platform/core/reference/gt-class-methods/translation/check-job-status)
* 新增了 [`queryFileData`](/docs/platform/core/reference/gt-class-methods/translation/query-file-data)
* 已弃用 `checkSetupStatus` (请改用 [`checkJobStatus`](/docs/platform/core/reference/gt-class-methods/translation/check-job-status)) 
* 已弃用 `checkFileTranslations` (请改用 [`queryFileData`](/docs/platform/core/reference/gt-class-methods/translation/query-file-data))

### `gtx-cli`

* 为 [`translate`](/docs/cli/reference/commands/translate) 命令新增了 `--enable-branching` 标志
* 为 [`translate`](/docs/cli/reference/commands/translate) 命令新增了 `--branch` 标志
  * (可选) 覆盖用于翻译的 分支
* 为 [`translate`](/docs/cli/reference/commands/translate) 命令新增了 `--disable-branch-detection` 标志
  * (可选) 禁用后，CLI 将不再自动尝试检测要使用的 分支。
  * 如果未安装 `git`，或项目不是 git 仓库，请使用此标志。
* 改进了翻译进度跟踪和日志输出
* 改进了翻译错误处理
* 优化了 API 性能，避免不必要的 API 文件上传

### `gt-sanity`

* 已更新为使用最新版 `generaltranslation`
* 翻译默认使用主 分支。
  * 对文档草稿预览 分支 的支持将在后续版本中加入。

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
