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 stage

Note: 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

ParameterDescriptionTypeOptionalDefault
--api-keySpecify a production API keystringtrue
--project-idSpecify the project IDstringtrue
--version-idSpecify a version ID (by default, a hash of the content)stringtrue
--config <path>Specify a path to the GT config filestringtrue"gt.config.json"
--tsconfig, --jsconfig <path>Specify a path to the TS or JS config filestringtrue
--src <paths>Specify the source directory(s) to scan[string]true./src && ./app && ./pages && ./components
--dictionary <path>Specify a path to the dictionary filestringtrue
--inlineInclude inline <T> tags in addition to the dictionarybooleantruetrue
--timeoutThe timeout for the translation request in secondsnumbertrue600
--new, --locales <locales>Locales to translate your project into[string]true
--default-locale <locale>The source locale for the projectstringtrueen
--ignore-errorsIgnore errors and force translation for valid contentflagtruefalse
--dry-runDry run the commandflagtruefalse

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:

ParameterDescription
--dry-runThis 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-keyUnless you are using --dry-run, you must provide a production API key.
--project-idSimilarly, 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.

Additionally, this property ensures that the translate command will not duplicate the translations done by the stage command.

How is this guide?