Staging

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 the same way as the translate command, but instead of downloading 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 intended for production builds and should not be used in development. Before running this command, 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 the path to the GT config filestringtrue"gt.config.json"
--tsconfig, --jsconfig <path>Specify the path to the TS or JS config filestringtrue
--src <paths>Space-separated list of glob patterns to match source files. Should be relative to the 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 the 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-runRun the command without making changesflagtruefalse

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 run without first running stage for a specific deployment version, the CLI will error and exit.

How is this guide?

Staging