The JTranslate CLI is a project integration that enables you to run a single command from your terminal and bring all of your JSON target languages in your project up to date with your source.
We recommend installing the JTranslate CLI globally, then you can hop around in your terminal and use it across all your projects:
npm install -g jtranslate-cli@latest
pnpm add -g jtranslate-cli@latest
yarn global add jtranslate-cli@latest
bun add -g jtranslate-cli@latest
npm directory listing: https://www.npmjs.com/package/jtranslate-cli
If you would rather call via npx instead - that's fine, however most of the CLI commands require auth, and knowledge of a web project. This means the chances that your npx command runs into a 404 or unauthorised response is pretty high.
There is a work around for this and it's how we recommend you approach integrating CI/CD, (for example if you want to update all translations as part of your projects git/deployment pipelines) - see CI/CD for a more in-depth explaination of this.
CLI keys are project-scoped and tied to your specific user.
In the web app navigate to the integrations tab in the project you'd like to setup the CLI with. Then click on JTranslate CLI and then create a new CLI key from within the right-hand side panel.
All CLI keys start with:
jtcli_
Don’t commit it. Don’t share it. Treat it like a password.
init your project as you from their terminal and make breaking changes to your project, such as overwriting all your translations for that project, as well as burn through your translation keys.
Now that you have your CLI key, and the jtranslate-cli is installed globally, you can trigger the setup wizard by running the following command from the root of your project:
jtranslate init <cli_key>
This will go through some essential setup steps such as locating the folder your locales are stored in, as well as identifying your source json and saving auth locally on your machine.
~/.jtranslate/auth.json%USERPROFILE%\.jtranslate\auth.jsonAt this point you're all setup and you're now ready to run commands and talk with your remote web project.