Generate Source Template
How to generate a source template for your project
Usage
npx gtx-cli generateOverview
The gtx-cli generate command generates a source file for your project for your default locale and supported locales.
The generated files are compatible with the gt-next and gt-react libraries, and are the same format used by the translate command.
After generating the source files, you can use local translations to serve the translations to your users.
This command is only useful if you are using your own translation service.
If you are using the General Translation API, you should use the translate command instead.
Parameters
| Parameter | Description | Type | Optional | Default |
|---|---|---|---|---|
--src <paths> | Space-separated list of glob patterns to match source files. Should be relative to root directory. | [string] | true | [ 'src/**/*.{js,jsx,ts,tsx}', 'app/**/*.{js,jsx,ts,tsx}', 'pages/**/*.{js,jsx,ts,tsx}', 'components/**/*.{js,jsx,ts,tsx}', ] |
--dictionary <path> | Specify a path to the dictionary file | string | true | |
--tsconfig, --jsconfig <path> | Specify a path to the TS or JS config file | string | true | |
--inline | Include inline <T> tags in addition to the dictionary | boolean | true | true |
--default-locale <locale> | The source locale for the project | string | true | en |
--ignore-errors | Ignore errors and force translation for valid content | flag | true | false |
Setup
First, run the gtx-cli configure command to configure your project's settings.
npx gtx-cli configureThen, run the gtx-cli generate command to generate template files for your project.
npx gtx-cli generateConfiguration file
Read more about the gt.config.json file here.
How is this guide?