Lokalise supports structured JSON files.
Structured JSON file entries can contain the following properties:
translation
– The actual translation (required)notes
– Description of the key (optional)context
– Context of the key (optional)limit
– Character limit for the key (optional)
You might also be interested in checking out our JSON localization tutorial (aimed towards web devs).
Example:
{
"mm_homepage": {
"translation": "Homepage",
"notes": "Title for main menu"
},
"mm_about": {
"translation": "About us",
"notes": "Title for main menu",
"limit": 20
},
"somekey": {
"translation": "First level key"
},
"somekey::sub": {
"translation": "Second level key"
}
}
Keep in mind that structured JSON does not support key nesting (multi-level keys, such as nested JSON), so all of the keys must be provided in one level. This also applies to export — all of the selected keys to be exported in structured JSON format will be exported in one level.
If you are using TypeScript and want to add autocompletion feature for your key names, you can add the following line of code to your app:
keyof typeof import ('./path/to/some/json/file.json')