Configuration

A guide to the gt.config.json file

Overview

The gt.config.json file configures your project's GT settings. It should be placed in the root of your project.

The CLI setup wizard npx gtx-cli init will create a gt.config.json file for you in your project.

Configuration

The three most important properties are:

  • defaultLocale: The default locale for your project. This is the locale your source content is written in. It’s also your project’s fallback locale.

  • locales: An array of locales for your project. These are the locales you want to translate your project into. See the supported locales for more information. If you’re using gt-next or gt-react, these are also the locales your app supports.

  • files: While optional for React component translation, this field contains information about the files you want to translate. See the files section for more information.

Examples

Here’s an example of a gt.config.json file:

gt.config.json
{
  "defaultLocale": "en",
  "locales": ["fr", "es"],
  "files": {
    "json": {
      "include": ["public/locales/[locale].json"]
    }
  }
}

This will translate the public/locales/en.json file into public/locales/fr.json and public/locales/es.json.

en.json
fr.json
es.json
gt.config.json
package.json

Next steps

How is this guide?

Configuration