# gt: General Translation CLI tool: gt configure
URL: https://generaltranslation.com/zh/docs/cli/reference/commands/configure.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 创建 General Translation 的 gt.config.json 文件。gt configure 命令的 API 参考。

创建或更新 `gt.config.json`，但不会像 [`gt init`](/docs/cli/reference/commands/init) 那样对 React 框架进行实验性改写。该命令仍可生成加载器、安装 CLI、提示登录，并配置开发凭据。

该命令会解析区域设置以及要翻译的文件类型。`--locales` 会替换已配置的区域设置列表，`--file-formats` 会替换设置过程中提供的格式选项；其他格式和无关设置均会保留。若想了解生成后的文件，请参阅[配置 CLI](/docs/cli/guides/configuring)。

```bash
npx gt configure
```

## 工作原理 [#how-it-works]

1. 读取现有配置，并根据选项、`gt.config.json` 或交互式提示解析默认区域设置、目标区域设置和文件类型。仅在使用 `--defaults` 时才会提供推荐的默认值。
2. 写入 `defaultLocale`、`locales` 和 `files` 对象，不会替换无关的文件配置。

如果只需生成配置而不执行完整初始化，请[手动编写该文件](/docs/cli/guides/configuring#create)；如果只需身份验证而不更改初始化配置，请使用 [`gt login`](/docs/cli/reference/commands/login)。[凭据优先级](/docs/cli/guides/configuring#credentials)和[本地写入失败边界](/docs/cli/reference/commands/init#notes)的规则同样适用。

## 选项 [#flags]

`configure` 接受 [`gt init` 的初始化、配置和凭据选项](/docs/cli/reference/commands/init#flags)，但不包括框架初始化选项。它也支持相同的[无头运行](/docs/cli/reference/commands/init#headless)方式。此外，[全局选项](/docs/cli/reference/global-options)同样适用。

## 示例 [#example]

```bash
# 以交互方式生成 gt.config.json
npx gt configure
```

## 其他说明 [#notes]

* 在 monorepo 中，请在特定 app directory 中运行 `configure`。如果在包含 `pnpm-workspace.yaml` 或 `workspaces` field 的 workspace root 中运行，该命令会停止，且不会更改文件，除非其中仅列出了该应用本身。
* Electron 应用程序不支持自动配置。
* 生成的 `gt.config.json` 包含 `defaultLocale`、`locales`，以及一个用于说明待翻译内容的 `files` 对象。有关所有可用选项，请参阅[配置参考](/docs/cli/reference/config)。

## Sitemap

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