# gt: General Translation CLI tool: TypeScript and JavaScript URL: https://generaltranslation.com/en-US/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 file keys. ## Update static data exports [#data-exports] When an updated TypeScript or JavaScript file contains static data exports, General Translation reuses matching strings from earlier translations and translates only new or changed strings. Reuse applies to exported variables whose values contain only literals, arrays, and plain objects. Exports with spreads, identifiers, function calls, template literals, or JSX use the standard translation path. Force retranslation and Glossary retranslation skip this incremental reuse.