Automatic Translation

How to automatically translate your project using the General Translation CLI tool

npx gtx-cli@latest

Overview

The General Translation CLI tool (gtx-cli) allows you to automatically translate your project into any of the supported languages.

It provides first-class support for gt-next and gt-react with your project, allowing you to scan your project for translatable content, translate your project, and generate translation data JSON files.

The CLI tool can also be used to generate translations for third-party i18n libraries like next-intl or i18next.

Lastly, the CLI tool can be used to translate JSON, Markdown, MDX, JS, and TS files.

A Production API key is required for the translate command. Get one for free at generaltranslation.com!


There are two main commands you should be aware of: init and translate.

  • The init command is used to setup your project. It provides a step by step wizard that will configure your project for internationalization, including:
  • Setting up plugins and React providers
  • Generating API keys
  • Configuring your project's locales and files structure
  • The translate command is meant to be added to your CI/CD pipeline. It is used to scan your project for content to be translated. The content is then uploaded to a CDN or added to your app bundle to be used at runtime.

Getting Started

Depending on what i18n library your project is using, please follow one of the following tutorials:

Usage

CommandDescription
npx gtx-cli initRun the GT setup wizard.
npx gtx-cli configureConfigure your project's GT settings.
npx gtx-cli translateTranslates your project via the GT API.
npx gtx-cli authGenerate an API key and project ID for your project.
npx gtx-cli generateGenerates a new translation data JSON file. Should be used when using the library standalone.

How is this guide?