Skip to main content

Localization

Translatation file

All translations are named <lang>.json in the locale folder, <lang> should be a specific language number, such as en, zh-cn, etc. The languages supported in the editor are listed in the corresponding translation documentation of the editor.

Structure

For a specific JSON file, the following format should be satisfied

{
"message.id.1": "this is message 1",
"message.id.2": "this is message 2"
}

In the above format, the JSON file must have an object consisting of only key-value pairs, where the key must be a legal string satisfying [a-zA-Z0-9-.] which is the translation ID, and the value must be a string type, which is the corresponding translation content.

Conflict

Multiple extensions may provide translations for the same translation ID, in which case the later loaded extension should overwrite the previously loaded translation. In particular, the translation that specifies the body of the editor must be the first one loaded.

For example, the extension A translation file en.json looks like this.

{
"message.say": "Hello!",
"message.world": "World!"
}

Extension B translates the file en.json as follows.

{
"message.say": "How are you?",
"message.hi": "Hi!"
}

If extension A is loaded first and extension B is loaded second, then the final translation loaded into the editor will be equivalent to the following, and you can see that the contents of message.say are overwritten.

{
"message.say": "How are you?",
"message.world": "World!",
"message.hi": "Hi!"
}