With the jtranslate-cli installed either locally or globally, you can run commands with the following pattern:
jtranslate <command> [options]
jtranslate -h
jtranslate <command> -h
initTriggers the setup wizard 🧙♂️ and links your local directory to your remote web project.
jtranslate init <cli_key>
Your CLI key is generated in the web app (Project → Integrations → JTranslate CLI) see Getting Started for a more in-depth guide.
init refuses to run it is due to either an invalid cli-key or because .jtranslate.config.json already exists in the project (simply delete it if you would like to re-init).| Arguments / Flags |
|---|
| None. |
statusThe status command compares the state of your local project languages (source & targets) with your web project.
jtranslate status
If the source is in sync, it will also tell you which of your target languages are due updates.
If your source isn't in sync (you’ve changed your local source and haven't pushed it yet), run jtranslate push --no-wizard first, then status will show what's out of date.
| Arguments / Flags |
|---|
| None. |
pushThe push command uploads your source JSON to your web project and initiates the update wizard.
The update wizard consists of firstly evaluating what's changed in the source, it then shows you what is required in order to update each one of your target languages. After you have chosen which languages you'd like to bring up to date, there will be a translation key cost calculation before finally showing you a confirmation prompt.
If you confirm to go ahead, a Quick Translation job will begin and once completed, will pull the updated language files back down into your languages folder (so your local repo stays in sync and up to date).
jtranslate push
You can however completely skip the update wizard if you so choose, and run this command in a sort of "one-shot" quick pass mode by making use of some of the following flags:
| Arguments / Flags |
|---|
--no-wizard - Pushes your source file to the project and goes no further. Skips the update wizard enitrely. |
--clean-up - Will also remove any outdated/deleted keys that exist in your target languages but not in the source |
--all - Auto-confirms all target languages that are due an update (can't be used with --only) |
--only <list> - Specify a list of comma-separated aliases (file names) to translate if they are due updating, i.e: es,fr,pt,de |
--approve-cost - Skips the final cost confirmation prompt - also explicitly requires you set --only or --all) |
--locales <dir> - A relative path to your JSON languages (required when running with npx) |
--source <file> - The name of your source file (i.e: en-us.json) (required when running with npx) |
jtranslate push --clean-up --all --approve-cost
The same as above but you don't want to translate everything, only spanish and portuguese:
jtranslate push --clean-up --only es,pt --approve-cost
A CI/CD example (still requires auth env-var setting: JTRANSLATE_CLI_KEY), see CI/CD for more info:
npx jtranslate-cli push --locales <dir> --source <file> --clean-up --all --approve-cost
Pulls your target languages from JTranslate web and overwrites your local copies.
This is particularly useful if you have added new target languages to your project or changed the file name (alias) of any of them. The pull command will sync everything locally back up to your remote.
Example usage:
Pull all target languages:
jtranslate pull
Pull only specific files:
jtranslate pull --only es,fr
| Arguments / Flags |
|---|
--only <list> - Specify a list of comma-separated aliases (file names) to pull |