# gt: General Translation CLI tool: gt generate URL: https://generaltranslation.com/en-US/docs/cli/reference/commands/generate.mdx --- title: gt generate 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 handle 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 — [``](/docs/react/reference/components/t) components and [`useGT`](/docs/react/reference/hooks/use-gt) calls — and includes your dictionary, the same way [`gt translate`](/docs/cli/reference/commands/translate) collects content. 3. Writes a source template file for each locale in the format `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 ` | Glob patterns for source files. | `string[]` | Yes | `src`, `app`, `pages`, `components` globs | | `--dictionary ` | Path to the dictionary file. | `string` | Yes | — | | `--tsconfig, --jsconfig ` | Path to a TS or JS config file. | `string` | Yes | Auto-detected | | `--inline` | Include inline content such as `` and `useGT`. | `boolean` | Yes | `true` | | `--default-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). Re-run `generate` whenever your source content changes.