CLI 2.0 with multi-file support

Jakub Pomykała
Jakub Pomykała
Last updated: March 18, 20223 min read
CLI 2.0 with multi-file support

Hey there! In the latest update, I implemented a frequently requested feature which is multi-file support in a new version of SimpleLocalize CLI, and I wanted to share with you how to use it. See the below updates that should help you in your daily translation and management work with SimpleLocalize. ☺️

How to download translation using command-line tool

Multi-file support

Multi-file support gives you a possibility to upload and download files which have a structure like below.

.
├── ca
│   ├── common.json
│   └── home.json
├── en
│   ├── common.json
│   └── home.json
└── es
    ├── common.json
    └── home.json

The newest version of CLI will automatically detect if you are trying to upload or download files with namespaces and/or languages. Namespaces in the example above are home and common, and languages are ca, en, es.

How to upload translations?

To upload such a structure of translations, you can run command like below:

simplelocalize upload
  --apiKey <PROJECT_API_KEY>
  --uploadPath /{lang}/{ns}.json
  --uploadFormat single-language-json

In the example above, {ns} is a namespace and {lang} is a language.

See upload command documentation page.

How to download translations?

Once you finish translating your content, you can run a download command to update translation files or/and add new ones!

simplelocalize download
  --apiKey <PROJECT_API_KEY>
  --downloadPath /{lang}/{ns}.json
  --downloadFormat single-language-json

See download command documentation page.

Options flag is now available

You can use CLI to download all available file formats. Some formats offer additional options, for example if you would like to download an Excel file with translations and translation key descriptions, you can run:

simplelocalize download
  --apiKey <PROJECT_API_KEY>
  --downloadPath /locales/translations.xlsx
  --downloadFormat excel
  --downloadOptions INCLUDE_DESCRIPTIONS

You can see currently available options in the 'Data' tab in the project view, when Developer mode is turned on in the top-right corner.

export translations section

Additional options are also supported in the Upload command, and you can apply them respectively with --uploadOptions parameter.

Faster CLI and smaller file size

SimpleLocalize CLI 2.0 brings many small improvements, one of those is much smaller CLI size. The newest version is only 15 megabytes, comparing to the previous 1.1.x version with 50 megabytes. CLI still has zero dependencies, which means you don't need to have Java, Python, node or any other software to run the CLI.

Other improvements:

  • better compatibility between operating systems,
  • new API which responds much faster for CLI requests,
  • better error handling,
  • more meaningful error messages.

How to update or install CLI?

To install CLI version 2.x, you can invoke the command below. It will automatically detect your operating system and download SimpleLocalize CLI. If you would like to download CLI executable manually, without the script, you can find all CLI releases on GitHub.

curl -s https://get.simplelocalize.io/2.7/install | bash

How to check what CLI version I'm running?

You can simply check what is your current CLI version by running CLI with --version parameter.

simplelocalize --version
or
simplelocalize-cli --version
or
./your-downloaded-simplelocalize --version

Troubleshooting

If you have any troubles with CLI, please visit troubleshooting page for solutions. You can also report the problem on GitHub.

What's next?

In the upcoming weeks, we would like to focus on adding more CLI small features based on the given feedback.

Stay tuned for more updates and new features! 🚀

Jakub Pomykała
Jakub Pomykała
Founder of SimpleLocalize