# gt: General Translation CLI tool: PO / POT
URL: https://generaltranslation.com/zh/docs/cli/reference/formats/po-pot-files.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 使用 General Translation CLI 翻译 PO 和 POT gettext 文件。PO 和 POT 文件格式的 API 参考。

CLI 可翻译 [GNU gettext](https://www.gnu.org/software/gettext/) 使用的 [PO (Portable Object) ](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) 和 POT (PO Template) 文件。POT 文件保存从代码中提取的源字符串，PO 文件则保存各个区域设置的翻译。翻译结果会保留原始的 PO/POT 语法。

## 配置 [#config]

在 `files` 下添加一个 `pot` 条目。由于 POT 文件 属于源模板，请将 `transformationFormat` 设置为 `PO`，这样翻译后的输出会写入 `.po` 文件。

```json title="gt.config.json"
{
  "defaultLocale": "en",
  "locales": ["zh", "es", "ja"],
  "files": {
    "pot": {
      "include": ["locales/[locale]/*.pot"],
      "transformationFormat": "PO"
    }
  }
}
```

`pot` 和 `POT` 都可作为配置键使用。所有文件键请参阅[配置参考](/docs/cli/reference/config#files)。

## Sitemap

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