Learn how to generate multi-language images in seconds with Bannerly!See Bannerly.io

JSON - Multi Language

Last modified: January 05, 2022Author: Jakub Pomykała

One of the most common JSON format for apps and software localization is JSON file with all translations as shown below. It's easy to use because you can fetch only one file and use all translations.

File format example

{
  "de": {
    "SALE": "Verkauf",
    "ADDRESS": "Adresse"
  },
  "fr": {
    "SALE": "soldes",
    "ADDRESS": "adresse"
  }
}

You can also use single-language-json format to download only needed translation messages for the requested language key.

SimpleLocalize also recognizes nested JSON keys like shown below.

{
  "de": {
    "SALE": {
      "NESTED": "Verkauf"
    }
  }
}

Above JSON will result with SALE.NESTED translation key.

Upload with CLI

simplelocalize upload --apiKey <PROJECT_KEY> \
  --uploadFormat multi-language-json \
  --uploadPath ./translations.json

Upload with CLI from many locations Soon available

Use --uploadOptions MULTI_FILE to upload translations from multiple project locations.

simplelocalize upload --apiKey <PROJECT_KEY> \
  --uploadFormat multi-language-json \
  --uploadPath ./translations.json \
  --uploadOptions MULTI_FILE

Learn more about SimpleLocalize CLI and translations upload feature.

Download with CLI

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat multi-language-json \
  --downloadPath ./translations.json

Learn more about SimpleLocalize CLI and translations download feature.

Download with CLI as nested JSON Soon available

Use --downloadOptions WRITE_NESTED to download translations as nested JSON like below.

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat multi-language-json \
  --downloadPath ./translations.json \
  --downloadOptions WRITE_NESTED

Result

{
  "de": {
    "SALE": {
      "NESTED": "Verkauf"
    }
  }
}

Download with CLI to many locations Soon available

Use --downloadOptions MULTI_FILE to download translations to multiple locations. This options works only if you uploaded translations files previously with --uploadOptions MULTI_FILE

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat multi-language-json \
  --downloadPath ./my-project \
  --downloadOptions MULTI_FILE

Import with API

curl
    --request POST \
    --url 'https://api.simplelocalize.io/api/v2/import?uploadFormat=multi-language-json' \
    --header 'x-simplelocalize-token: <API_KEY>' \
    --form file=@/path/to/your/file.json

Learn more about importing translations with API

Export with API

curl
    --request GET \
    --url https://api.simplelocalize.io/api/v3/export?downloadFormat=multi-language-json \
    --header 'x-simplelocalize-token: <API_KEY>'

Learn more about exporting translations with API