# gt: General Translation CLI tool: 継続的翻訳
URL: https://generaltranslation.com/ja/docs/cli/guides/continuous-translation.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: デプロイやプッシュのたびに翻訳を自動で最新の状態に保つ方法を選びます。

継続的翻訳では、新規または変更されたコンテンツのみを翻訳し、割り当て済みのコンテキストグループを適用します。既存の翻訳は実行のたびに保持されます。

まずは、CD でビルドコマンドの前に [`npx gt translate`](/docs/cli/reference/commands/translate) を実行しましょう。これが最もシンプルなセットアップです。プルリクエストを自動作成したい場合や、CI のステージを分けたい場合は、別の方法を選んでください。

## アプローチを選択する [#approaches]

<Cards>
  <Card title="CD で実行する" href="/docs/cli/guides/continuous-translation/running-in-cd">
    最もシンプルなセットアップです。ビルドコマンドの前に gt translate を追加するだけで、デプロイのたびに最新の翻訳が反映されます。
  </Card>

  <Card title="GitHub Actions を使用する" href="/docs/cli/guides/continuous-translation/using-github-actions">
    公式の GitHub Action を使用して、プッシュ時に翻訳を実行し、プルリクエストを自動で作成します。
  </Card>

  <Card title="CI でステージングする" href="/docs/cli/guides/continuous-translation/staging-in-ci">
    lint とテストの実行中に gt stage を開始し、ビルド前に完了した翻訳をダウンロードします。
  </Card>

  <Card title="CI ステージを分割する" href="/docs/cli/guides/continuous-translation/splitting-ci-stages">
    スタンドアロンのファイル向けに、アップロード、キューへの追加、ダウンロードをそれぞれ独立したジョブに分割します。
  </Card>

  <Card title="Locadex GitHub App" href="/docs/platform/locadex/quickstart">
    ダッシュボードでパブリックまたはプライベートの GitHub リポジトリを接続するだけで、翻訳プルリクエストの作成から auto-merge までを自動化できます。
  </Card>
</Cards>

## 共通要件 [#credentials]

CLI による自動化の方法には、いずれも次の2つが必要です。

1. **コミット済みの `gt.config.json`**：アプリのルートに配置し、ロケール、ファイル、出力パスを宣言します ([CLI の設定](/docs/cli/guides/configuring)を参照) 。
2. **スコープを限定した[プロジェクトAPIキー](/docs/platform/dashboard/reference/api-keys#create-project-keys)**：プロジェクトIDとあわせて、CI/CD のシークレットに `GT_API_KEY` および `GT_PROJECT_ID` として保存します。**プロジェクト &gt; API キー** で **ファイル &gt; 書き込み** (読み取りを含む) 、**翻訳キュー &gt; 有効**、**文脈 &gt; 書き込み** を付与するか、[`gt api-key create`](/docs/cli/reference/commands/api-key-create) で作成します。

```bash
npx gt api-key create --name "CI translation" \
  --permission project:files:read \
  --permission project:files:write \
  --permission project:translations:enqueue \
  --permission project:context:write
```

<Callout type="warn">
  ランタイム専用の開発用キーでは不十分です。`GT_API_KEY` は絶対にコミットせず、`gt.config.json` にも記述しないでください。また、`NEXT_PUBLIC_` や `VITE_` などの公開用プレフィックスを付けて公開することも避けてください。
</Callout>

## Next steps

- /docs/cli/guides/continuous-translation/running-in-cd
- /docs/cli/guides/continuous-translation/using-github-actions
- /docs/cli/guides/continuous-translation/staging-in-ci
- /docs/cli/guides/continuous-translation/splitting-ci-stages

## Sitemap

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