Yaml

Last modified: June 17, 2022Author: Jakub Pomykała

Many i18n libraries use YAML files to keep translation messages. SimpleLocalize supports yaml format to import and export translations. You can use nested translations keys as shown below.

File format example

hello-world: Hello world!
home.interface.signup: Signup
home.interface.email: Email address
home.interface.password: Password

SimpleLocalize also recognizes nested YAML keys, as shown below.

hello-world: Hello world!
home:
  interface:
    signup: Signup
    email: Email address
    password: Password

Importing a file above will result with:

  • hello-world
  • home.interface.signup
  • home.interface.email
  • home.interface.password

translation keys in Translation Editor.

Upload translation files

Upload with command-line tool

simplelocalize upload --apiKey <PROJECT_KEY> \
  --uploadFormat yaml \
  --uploadPath ./translations_{lang}.yaml

Learn more about uploading translations with CLI.

Import with REST API

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

Learn more about importing translations with API.

Download translation files

Download with command-line tool

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat yaml \
  --downloadPath ./translations_{lang}.yaml

To download translations with nested keys use option WRITE_NESTED. See all download options.

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat yaml \
  --downloadPath ./translations_{lang}.yaml \
  --downloadOptions WRITE_NESTED

Learn more about downloading translations with CLI.

Export with REST API

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

Learn more about exporting translations with API