gtx-cli

raw JSON →
2.14.19 verified Sat Apr 25 auth: no javascript

CLI tool for AI-powered i18n (wrapper for gt). Current stable version: 2.14.19. Active development. Key differentiators: leverages General Translation's AI for automated localization workflows. Alternative to manual i18n tooling, integrates with gt ecosystem.

error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/gtx-cli/index.mjs not supported.
cause Using CommonJS `require()` on an ESM-only package.
fix
Switch to import { gtx } from 'gtx-cli' and set "type": "module" in your package.json, or use dynamic import().
error TypeError: gtx is not a function
cause Default import of package that only exports named exports.
fix
Use import { gtx } from 'gtx-cli' instead of import gtx from 'gtx-cli'.
breaking In v2.x, the API changed from default export to named export. Use `import { gtx } from 'gtx-cli'` instead of `import gtx from 'gtx-cli'`.
fix Update import to named export: import { gtx } from 'gtx-cli'
deprecated The `cli` function is deprecated in favor of `runGtx`.
fix Replace `cli` with `runGtx`
gotcha The package is ESM-only and does not support CommonJS `require()`.
fix Use `import` syntax and ensure your project supports ESM.
npm install gtx-cli
yarn add gtx-cli
pnpm add gtx-cli

Example of using gtx-cli to run translation on locale files with API key.

import { gtx } from 'gtx-cli';

const result = await gtx({
  source: './src/locales',
  target: './dist/locales',
  apiKey: process.env.GT_API_KEY ?? '',
});

console.log('Translation completed:', result);