# gt: General Translation CLI tool: Text URL: https://generaltranslation.com/en-GB/docs/cli/formats/txt.mdx --- title: Text description: How to use General Translation to set up automatic translation for your project's text files --- ## Overview `gt` can be used to automatically translate any text files. We will follow these 4 steps: Add your environment variables Install [`gt`](/docs/cli) Configure your project's [`gt.config.json`](/docs/cli/reference/config) file Run [`gt translate`](/docs/cli/translate#translate) *** ## Step 1: Add your environment variables Add your production API key and project ID to your environment variables. This is necessary to use the `gt` tool. You can get these from the [General Translation dashboard](https://generaltranslation.com/dashboard). ```bash title=".env" GT_API_KEY= GT_PROJECT_ID= ``` ## Step 2: Install `gt` Install the `gt` tool in your project. ```bash npm i gt ``` ```bash yarn add --dev gt ``` ```bash bun add --dev gt ``` ```bash pnpm add --save-dev gt ``` ## Step 3: Configure your project's `gt.config.json` file Create a `gt.config.json` file in the root of your project, with the following content: ```json title="gt.config.json" { "defaultLocale": "en", "locales": ["es", "fr"], "files": { "txt": { "include": ["docs/[locale]/**/*.txt"] } } } ``` Change the `defaultLocale` and `locales` to match your project's locales. The string array in the `include` key should be a glob pattern that matches all your text files. It should use the `[locale]` placeholder to match the file's locale. See the [configuration](/docs/cli/reference/config) docs for more information about the `gt.config.json` file. ## Step 4: Add the `gt translate` command to your build process Add the `gt translate` command to your build or CI process before the build command to automatically add translations to your project. ```json title="package.json" { "scripts": { "translate": "npx gt translate", "build": "npm run translate && " } } ``` This will generate translations for all of your locales and save them to your project. If you want to commit these files to your repo, you can run this command instead before committing. You're done! Now your text files will be translated automatically whenever your source files change. *** ## Notes * You can automatically add translations to your project with the [`gt translate`](/docs/cli/translate) command. * If you want to commit your translation files, you should run the `gt translate` command before committing. * To configure the output path for your translations, see the [configuration](/docs/cli/reference/config) docs. ## Next steps * See the [translate command](/docs/cli/translate) for CLI usage details.