JSON
Quite a lot of JavaScript libraries or frameworks exist for localizing an application.
Therefore, we have defined a standard JSON format.
Format
- The JSON format is used.
- The key must not be quoted to write a valid JavaScript object (hash).
However, the key and value must be quoted in a valid JSON file. - The placeholder syntax is
{{ placeholder }}
. - The file can have a flat or hierarchical structure (see examples below).
- comments for segments can be added in the format
_<key of the associated segment>.comment=…
Used by
- most JavaScript i18n frameworks
- React Intl
Examples
Additional example files can be accessed here.
{
"title": "Titel",
"body.paragraph": "Dies ist ein Paragraph.",
"users.form.submit": "Speichern",
"users.salutation": "Hallo {{name}}"
}
{
"title": "Titel",
"body": {
"paragraph": "Dies ist ein Paragraph."
},
"users": {
"form": {
"submit": "Speichern"
},
"salutation": "Hallo {{name}}"
}
}
References
Updated 3 days ago