# General Translation Changelog: gt-cli 2.9.0: Twilio Content Template の翻訳
URL: https://generaltranslation.com/ja/blog/gt-cli_v2_9_0.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 
Authors: Ernest McCarter
Published: 2026-03-10

## 概要

`gt` CLI が、Twilio Content JSON をファイル形式としてサポートするようになりました。Twilio の Content Template Builder を使って WhatsApp、SMS、RCS で構造化メッセージを送信している場合、アプリですでに使っているのと同じ [`gt translate`](/docs/cli/reference/commands/translate) ワークフローで、それらのテンプレートも翻訳できるようになりました。

## なぜ重要なのか

Twilio Content Templates は、構造化されたメッセージ (変数を含むテキスト、クイック返信ボタン、メディアやアクション付きのカード) を定義する JSON ファイルです。これらのテンプレートには、ボタンラベル、本文テキスト、カードタイトルなど、ユーザー向けの文字列が含まれています。複数の言語でメッセージを送信する場合、こうした文字列を翻訳する必要があります。

現在は、Twilio Console または API を使って、言語ごとに個別のコンテンツテンプレートを手動で作成する必要があります。各テンプレートにはそれぞれ独自の SID、独自の承認プロセス、独自の運用負担があります。言語をまたいでメッセージの内容を一元管理できる信頼できる情報源はありません。

この CLI アップデートにより、テンプレートをデフォルト言語で一度作成すれば、あとは [`gt translate`](/docs/cli/reference/commands/translate) が残りを処理します。

## 手順

Twilio を使って WhatsApp 上で顧客サポートフローを構築しているとします。ユーザーへのあいさつと 3 つの選択肢を含むクイック返信テンプレートがあるとしましょう。

```json
{
  "friendly_name": "support_greeting",
  "language": "en",
  "variables": { "1": "Customer" },
  "types": {
    "twilio/quick-reply": {
      "body": "Hi, {{1}}. Thanks for contacting support. How can we help?",
      "actions": [
        { "title": "Check order status", "id": "order_status" },
        { "title": "Return an item", "id": "return_item" },
        { "title": "Speak with an agent", "id": "speak_agent" }
      ]
    },
    "twilio/text": {
      "body": "Hi, {{1}}. Thanks for contacting support. How can we help?"
    }
  }
}
```

`actions` 内の `body` フィールドと `title` の値は、いずれも翻訳可能な文字列です。`{{1}}` の変数プレースホルダー、`id` フィールド、および構造を表すキーは翻訳されません。


### ステップ 1: 設定

`gt.config.json` の設定に `twilioContentJson` を追加します。

```json
{
  "defaultLocale": "en",
  "locales": ["en", "es", "fr", "ja"],
  "files": {
    "twilioContentJson": {
      "include": ["twilio/[locale]/**/*.json"]
    }
  }
}
```

`include` パス内の `[locale]` プレースホルダーは、CLI にソースファイルの場所と翻訳ファイルの保存先を指示します。ソースファイルは `twilio/en/` から読み込まれ、翻訳されたファイルは `twilio/es/`、`twilio/fr/` などに保存されます。


### ステップ2: translate

```bash
npx gt@latest translate
```

翻訳は、設定された各ロケールごとに生成されます。出力では Twilio JSON の構造はそのまま保持され、変わるのは文字列の値だけです。

スペイン語での出力は次のようになります。

```json
{
  "friendly_name": "support_greeting",
  "language": "es",
  "variables": { "1": "Customer" },
  "types": {
    "twilio/quick-reply": {
      "body": "Hola, {{1}}. Gracias por contactar con soporte. ¿En qué podemos ayudarte?",
      "actions": [
        { "title": "Ver estado del pedido", "id": "order_status" },
        { "title": "Devolver un artículo", "id": "return_item" },
        { "title": "Hablar con un agente", "id": "speak_agent" }
      ]
    },
    "twilio/text": {
      "body": "Hola, {{1}}. Gracias por contactar con soporte. ¿En qué podemos ayudarte?"
    }
  }
}
```

各翻訳済みファイルは、有効な Twilio Content JSON テンプレートであり、ロケールごとの新しいテンプレートとして Twilio Content API に直接アップロードできます。


## リンク

* [CLI設定ドキュメント](/docs/cli/reference/config)
* [Twilio Content Template Builder](https://www.twilio.com/docs/content)
* [ソース](https://github.com/generaltranslation/gt/pull/1099)

## Sitemap

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