As an example you might have exactly one json file right now that contains all the translations:
Code: Select all
[
{
"id":"$mypark00",
"type":"park",
"title":"Park[de]Parkanlage",
"text":"A small but nice park.[de]Ein kleiner aber gemütlicher Park.",
...
},
{
"id":"$mypark01",
"type":"park",
"title":"Fountain[de]Springbrunnen",
"text":"Have some fresh water.[de]Hier gibt es kühles Nass.",
...
},
...
]
What you can do now is to have the sole definitions in one file (e.g. main.json)
Code: Select all
[
{
"id":"$mypark00",
"type":"park",
...
},
{
"id":"$mypark01",
"type":"park",
...
},
...
]

Translations can be put in separate files e.g. like (let's call it translations.json)
Code: Select all
[{
"id":"$myparkplugin_translations00",
"type":"translation",
"*":{ // * is the fallback if no more appropriate translation is available; it's like the first case of inline translations
"draft_mypark00_title":"Park",
"draft_mypark01_text":"A small but nice park.",
"draft_mypark00_title":"Fountain",
"draft_mypark01_text":"Have some fresh water."
},
"de":{
"draft_mypark00_title":"Parkanlage",
"draft_mypark01_text":"Ein kleiner aber gemütlicher Park.",
"draft_mypark00_title":"Springbrunnen",
"draft_mypark01_text":"Hier gibt es kühles Nass."
}
}]
You can access translations from Lua using the Theotown.translate function

Code: Select all
print(TheoTown.translate('draft_mypark00_title'))