CLI: Download translations

Last updated: October 08, 2024Author: 

Download translations to your local files using CLI. Choose the best matching file format for your project. Invoke 'download' command to get the latest version of translations.

Table of contents

Usage

Download works similarly to the upload command, but this time it exports translation files from the Translation Editor to your local files.

simplelocalize download
  --apiKey <PROJECT_API_KEY>
  --downloadPath <DOWNLOAD_PATH_PATTERN>
  --downloadFormat <DOWNLOAD_FORMAT>

Download format is a format of the file(s) with translations. See available upload formats

Example

Same as before you can use {lang} and {ns} placeholders to download many files at once and specify language keys that should be downloaded, eg.:

simplelocalize download
  --apiKey <PROJECT_API_KEY>
  --downloadPath ./src/{ns}/messages_{lang}.json
  --downloadFormat single-language-json
  --downloadLanguageKey en,de,fr

Additional parameters:

  • --downloadLanguageKey allows you to download translation for specified languages. E.g.: --downloadLanguageKey en,de,fr.
  • --downloadOptions allows you to pass additional options to the download command. E.g.: --downloadOptions WRITE_NESTED.
  • --downloadCustomerId allows you to download translations for a specific customer. E.g.: --customerId ikea.
  • --downloadNamespace allows you to download translations for a specific namespace. E.g.: --namespace home.
  • --downloadSort allows you to sort translations in the downloaded file. E.g.: --downloadSort NEWEST_KEYS_FIRST. Available options: NEWEST_KEYS_FIRST, NEWEST_KEYS_LAST, NAMESPACES, IMPORT_ORDER.

Since version 2.7 you can skip 'download' part in the parameters names, e.g.: --path instead of --downloadPath.

How to download translations using command-line tool (Version 2.1)

Example: Download all translations into one file

.
└── locales
    └── all-translations.json
simplelocalize download \
  --apiKey MY_API_KEY \
  --downloadFormat multi-language-json \
  --downloadPath ./locales/all-translations.json

Learn more about multi-language-json.

Example: Download translations for one language

.
└── locales
    └── english-translations.json
simplelocalize download \
  --apiKey MY_API_KEY \
  --languageKey en \
  --downloadFormat single-language-json \
  --downloadPath ./locales/english-translations.json

Learn more about single-language-json.

Example: Download translations into multiple directories

.
├── ca
│   └── translations.json
├── en
│   └── translations.json
└── es
    └── translations.json
simplelocalize download \
 --apiKey MY_API_KEY \
 --downloadPath ./{lang}/translations.json \
 --downloadFormat single-language-json

Example: Download translations into multiple directories and files

.
├── ca
│   ├── common.json
│   └── home.json
├── en
│   ├── common.json
│   └── home.json
└── es
    ├── common.json
    └── home.json
simplelocalize download \
 --apiKey MY_API_KEY \
 --downloadPath ./{lang}/{ns}.json \
 --downloadFormat single-language-json

See all available download formats

Example: Download customer translations

This option is only available with a Business plan.

.
└── locales
    └── ikea-translations.json
simplelocalize download \
 --apiKey MY_API_KEY \
 --downloadPath ./locales/ikea-translations.json \
 --customerId ikea \
 --downloadFormat multi-language-json

Download options

Many download formats offer additional options. You can activate them using --downloadOptions parameter.

simplelocalize download \
 --apiKey MY_API_KEY \
 --downloadPath ./translations.json \
 --downloadFormat multi-language-json \
 --downloadOptions WRITE_NESTED,INCLUDE_DESCRIPTIONS

See all available download options

Specifying languages to download

You can specify languages to download using --languageKey parameter.

simplelocalize download \
 --apiKey MY_API_KEY \
 --languageKey en,de,pl \
 --downloadPath ./translations_{lang}.json \
 --downloadFormat single-language-json
Was this helpful?