gt@2.11.0
Overview
The GT CLI can now publish any translated file type to the GT CDN. JSON, MDX, YAML, and all other supported file types can now be published directly from the translate, upload, and save-local commands.
Configuration
Global publish flag
Add --publish to any supported command:
npx gt translate --publishOr set it in gt.config.json:
{
"publish": true
}This publishes all translated files (including GT JSON) to the CDN.
Per-file publish control
You can opt individual files in or out using the include pattern syntax. Instead of a plain glob string, use an object with a publish flag:
{
"defaultLocale": "en",
"locales": ["fr", "es"],
"files": {
"json": {
"include": [
{ "pattern": "locales/[locale]/*.json", "publish": true },
{ "pattern": "locales/[locale]/internal/**/*.json", "publish": false }
]
}
}
}In this example, all JSON files under locales/[locale]/ are published to the CDN, except files under the internal/ subdirectory.
GT JSON publish control
GT's internal format has its own publish flag under the gt key:
{
"files": {
"gt": {
"output": "public/i18n/[locale].json",
"publish": true
}
}
}Resolution order
For any given file, the CLI resolves publish intent in this order:
- Explicit opt-out — file matches an
includeentry with"publish": false→ not published or removed from the CDN - Explicit opt-in — file matches an
includeentry with"publish": true→ published to the CDN - Global fallback — uses the top-level
publishsetting (defaults tofalseif unset)
If no publish configuration is set at any level, the publish step is skipped entirely — no API calls are made.
Commands that support publishing
| Command | Behavior |
|---|---|
gt translate | Publishes after downloading translations |
gt upload | Publishes after uploading source files |
gt save-local | Publishes after saving local edits |
Links
- CLI config reference
- PR #1122 — initial file publish support
- PR #1132 — opt-in fix
- PR #1133 — publish on save/upload