🚀 Getting Started

Link your local dev environment to your remote JTranslate web project. Keep your target languages in sync and up to date with the source, all from the comfort of your terminal.

The JTranslate CLI

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.

1) Installing the CLI

Global Install

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

npm directory listing: https://www.npmjs.com/package/jtranslate-cli

npx

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.

2) Getting your CLI key

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_

Keep your CLI key secret

Don’t commit it. Don’t share it. Treat it like a password.

No, seriously:
If your CLI key leaks, someone can 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.

JTranslate will not be liable for any loss, damage, unauthorised access, or project changes resulting from your failure to keep CLI keys secure.

3) Connecting to your web project

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.

  • macOS/Linux: ~/.jtranslate/auth.json
  • Windows: %USERPROFILE%\.jtranslate\auth.json

At this point you're all setup and you're now ready to run commands and talk with your remote web project.