YAML
Nick Ustinov avatar
Written by Nick Ustinov
Updated over a week ago

Lokalise supports YAML files version 1.2.

en:
  app:
    title: "Lokalise"
    :yes: "Yes"
    :no: "No"
    bacon:
      one: "1 bacon"
      other: "{{count}} bacons"

When adding a new key via the web interface, use : to refer to YAML levels, for example app:title. You can override the default separator (:) with a dot (.) in project settings > Advanced options.

Please note that if you are using integers as keys, they have to be quoted, otherwise you might get unexpected results. While this is not strictly required by the YAML format, it's enforced by some frameworks. Take a look at the following example:

en:
app:
title: "Lokalise"
:yes: "Yes"
:no: "No"
"078": "Value"
"001": "Integer Key"
bacon:
one: "1 bacon"
other: "count bacons"

You can see that all integer keys are quoted which is correct.

Arrays

Please follow these rules when storing arrays in your YAML files:

  • Use square brackets [ ] for single line arrays (flow sequence) which can be split to multiline

  • Use dashes - for multiline arrays (block sequence)

Here's an example of a multiline notation:

key: ["value1",
"value2",
"value3",
"value4",
"value5"]

You can also convert it to a block sequence:

key:
- value1
- value2
- value3
- value4
- value5
Did this answer your question?