# gt: General Translation CLI tool: TypeScript and JavaScript URL: https://generaltranslation.com/en-GB/docs/cli/reference/formats/ts-js-files.mdx --- title: TypeScript and JavaScript description: Translate TypeScript and JavaScript files with the General Translation CLI. API reference for the TypeScript and JavaScript file formats. --- The CLI translates TypeScript (`ts`) and JavaScript (`js`) files. All syntax and formatting in the source files is preserved in the translated files. ## Configuration [#config] Add a `ts` or `js` entry under `files` with an `include` array of glob patterns. Use the `[locale]` placeholder so the CLI can find source files and save translations to the right path. ```json title="gt.config.json" { "defaultLocale": "en", "locales": ["fr", "es"], "files": { "ts": { "include": ["scripts/[locale]/**/*.ts"] } } } ``` This translates every TypeScript file under `scripts/en` and saves the results to `scripts/fr` and `scripts/es`. Use the `js` key instead for JavaScript files. See the [configuration reference](/docs/cli/reference/config#files) for all the file keys.