Stage
How to stage your translations for review
Overview
gtx-cli stage is a command that generates translations for your project and stages them for review.
This command is only useful if you've enabled human review on your project.
Currently, this command is only supported for apps using gt-next or gt-react.
Usage
Run this in your CI pipeline before you build your app for production.
npx gtx-cli stageNote: This command requires a production API key! Get one on the platform.
The gtx-cli stage command works in the same way as the translate command, but instead of downloading the completed translations or publishing them to the CDN, it simply stages them for review.
After running gtx-cli stage, you should run gtx-cli translate to complete the process and download the translations (if configured to do so).
For Production Use Only!
This command is meant for production builds and should not be used in development.
Before running this command, please make sure you are on the branch that will be used for production.
Remember to also specify your production API key (GT_API_KEY) and Project ID (GT_PROJECT_ID) in your environment variables.
Flags
| Parameter | Description | Type | Optional | Default |
|---|---|---|---|---|
--api-key | Specify a production API key | string | true | |
--project-id | Specify the project ID | string | true | |
--version-id | Specify a version ID (by default, a hash of the content) | string | true | |
--config <path> | Specify a path to the GT config file | string | true | "gt.config.json" |
--tsconfig, --jsconfig <path> | Specify a path to the TS or JS config file | string | true | |
--src <paths> | Space-separated list of glob patterns to match source files. Should be relative to root directory. | [string] | true | [ 'src/**/*.{js,jsx,ts,tsx}', 'app/**/*.{js,jsx,ts,tsx}', 'pages/**/*.{js,jsx,ts,tsx}', 'components/**/*.{js,jsx,ts,tsx}', ] |
--dictionary <path> | Specify a path to the dictionary file | string | true | |
--inline | Include inline <T> tags in addition to the dictionary | boolean | true | true |
--timeout | The timeout for the translation request in seconds | number | true | 600 |
--new, --locales <locales> | Locales to translate your project into | [string] | true | |
--default-locale <locale> | The source locale for the project | string | true | en |
--ignore-errors | Ignore errors and force translation for valid content | flag | true | false |
--dry-run | Dry run the command | flag | true | false |
All of these parameters are optional.
Do not add your API key to the gt.config.json file!
You should set it as an environment variable instead. The CLI will automatically read GT_API_KEY if it is set.
There are a few key parameters:
| Parameter | Description |
|---|---|
--dry-run | This flag will cause the CLI to parse and validate your project, but will not communicate with the GT API. This is useful for validating your codebase. |
--api-key | Unless you are using --dry-run, you must provide a production API key. |
--project-id | Similarly, unless you are using --dry-run, you must provide a project ID. |
--new, --locales <locales> | Locales to translate your project into. These will be appended to the locales specified in your gt.config.json file. |
Configuration file
When running gtx-cli stage, the CLI will automatically add the stageTranslations : true property to your gt.config.json file.
This property ensures that if translate is ran without first runningstage for a specific deployment version,
the CLI tool will error and exit.
How is this guide?