# General Translation Changelog: gt 2.11.0: 任意のファイルタイプをCDNに公開
URL: https://generaltranslation.com/ja/blog/gt-cli_v2_11_0.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 
Authors: Fernando Aviles
Published: 2026-03-18

## 概要

GT CLI では、**翻訳済みのあらゆるファイル形式**を GT CDN に公開できるようになりました。JSON、MDX、YAML、その他すべての[対応ファイル形式](/docs/cli/reference/formats/gt-jsx-files)を、[`translate`](/docs/cli/reference/commands/translate)、[`upload`](/docs/cli/reference/commands/upload)、[`save-local`](/docs/cli/reference/commands/save-local) コマンドから直接公開できます。

## 設定

### グローバル公開フラグ

対応している任意のコマンドに `--publish` を追加します:

```bash
npx gt translate --publish
```

または、`gt.config.json`で設定します:

```json title="gt.config.json"
{
  "publish": true
}
```

これにより、翻訳済みの**すべて**のファイル (GT JSON を含む) が CDN に配信されます。


### ファイル単位の公開制御

`include` パターン構文を使うと、個々のファイルを公開対象に含めるか除外するかを指定できます。単なる glob 文字列ではなく、`publish` フラグを持つオブジェクトを使用します。

```json title="gt.config.json"
{
  "defaultLocale": "en",
  "locales": ["fr", "es"],
  "files": {
    "json": {
      "include": [
        { "pattern": "locales/[locale]/*.json", "publish": true },
        { "pattern": "locales/[locale]/internal/**/*.json", "publish": false }
      ]
    }
  }
}
```

この例では、`internal/` サブディレクトリ内のファイルを除き、`locales/[locale]/` 配下のすべての JSON ファイルが CDN に公開されます。


### GT JSON の公開制御

GT の内部形式には、`gt` キーの下に独自の公開フラグがあります。

```json title="gt.config.json"
{
  "files": {
    "gt": {
      "output": "public/i18n/[locale].json",
      "publish": true
    }
  }
}
```


### 解決順序

任意のファイルについて、CLI は次の順序で公開の対象かどうかを判定します。

1. **明示的なオプトアウト** — ファイルが `"publish": false` の `include` エントリに一致する → 公開されない、または CDN から削除される
2. **明示的なオプトイン** — ファイルが `"publish": true` の `include` エントリに一致する → CDN に公開される
3. **グローバルなフォールバック** — トップレベルの `publish` 設定を使用する (未設定の場合はデフォルトで `false`) 

どのレベルでも公開の設定がされていない場合、公開ステップは完全にスキップされ、API 呼び出しも行われません。

## 公開に対応するコマンド

| コマンド                                                       | 挙動                   |
| ---------------------------------------------------------- | -------------------- |
| [`gt translate`](/docs/cli/reference/commands/translate)   | 翻訳をダウンロードした後に公開      |
| [`gt upload`](/docs/cli/reference/commands/upload)         | ソースファイルをアップロードした後に公開 |
| [`gt save-local`](/docs/cli/reference/commands/save-local) | ローカルでの編集を保存した後に公開    |

## リンク

* [CLI 設定リファレンス](/docs/cli/reference/config)
* [PR #1122](https://github.com/generaltranslation/gt/pull/1122) — 初回のファイル公開に対応
* [PR #1132](https://github.com/generaltranslation/gt/pull/1132) — オプトインの修正
* [PR #1133](https://github.com/generaltranslation/gt/pull/1133) — 保存時およびupload時に公開

## Sitemap

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