# gt: General Translation CLI tool: gt generate
URL: https://generaltranslation.com/en-GB/docs/cli/reference/commands/generate.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Generate a source template for a General Translation project. API reference for the gt generate command.

Generates a source template file for your default locale and target locales, in the same format the [`translate`](/docs/cli/reference/commands/translate) command uses. Use it when you manage translations yourself rather than through the General Translation API, then serve the results with [local translations](/docs/react/guides/storing-translations).

*Note: Available for the framework and inline libraries — `gt-next`, `gt-react`, `gt-react-native`, `gt-tanstack-start`, `gt-node`, `gt-flask`, and `gt-fastapi`. It is not registered for base (non-framework) projects. If you use the General Translation API, use [`gt translate`](/docs/cli/reference/commands/translate) instead.*

Configure your project first, then generate the template.

```bash
npx gt configure
npx gt generate
```

## How it works [#how-it-works]

1. Reads `gt.config.json` to determine your default and target locales.
2. Scans your source code for inline content — [`<T>`](/docs/react/reference/components/t) components and [`useGT`](/docs/react/reference/hooks/use-gt) calls — and includes your dictionary, just as [`gt translate`](/docs/cli/reference/commands/translate) collects content.
3. Writes a source template file for each locale in the format [`translate`](/docs/cli/reference/commands/translate) uses, without calling the General Translation API.

## Flags [#flags]

`generate` accepts the same flags as [`gt translate`](/docs/cli/reference/commands/translate#flags). The flags most commonly used with it are below; the linked reference above lists the complete set.

| Parameter                       | Description                                                                                                                   | Type       | Optional | Default                                   |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------- | -------- | ----------------------------------------- |
| `--src <paths...>`              | Glob patterns for source files.                                                                                               | `string[]` | Yes      | `src`, `app`, `pages`, `components` globs |
| `--dictionary <path>`           | Path to the dictionary file.                                                                                                  | `string`   | Yes      | —                                         |
| `--tsconfig, --jsconfig <path>` | Path to a TS or JS config file.                                                                                               | `string`   | Yes      | Automatically detected                    |
| `--inline`                      | Include inline content such as [`<T>`](/docs/react/reference/components/t) and [`useGT`](/docs/react/reference/hooks/use-gt). | `boolean`  | Yes      | `true`                                    |
| `--default-locale <locale>`     | Source locale for the project.                                                                                                | `string`   | Yes      | `en`                                      |
| `--ignore-errors`               | Ignore errors found while scanning inline content.                                                                            | `boolean`  | Yes      | `false`                                   |

## Example [#example]

```bash
# Generate templates for the configured locales
npx gt generate

# Generate from a custom source locale, ignoring scan errors
npx gt generate --default-locale en-US --ignore-errors
```

## Other notes [#notes]

After generating the template files, serve them to your users with [local translations](/docs/react/guides/storing-translations). Run `generate` again whenever your source content changes.

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
