If function in json

Hi there^^ I want to make an Mod which include all completed translations - but for this i need a if function and i dont know if this will works …

so my idea is to check the user_settings for which language is activate and then use the following overrides (is needed because of different fonts and files)

so my idea was

var json = $.getJSON(“user_settings.json”),
if “language” = “de-De” {
“overrides” :{ …
if “language” = ru-Ru { …

or something that works ^^

1 Like

Hey hey, I had an idea for the mod manager that would allow you to specify a language and then pull and install the language, does that help?

Or instead the mod manager you could select which language and then it would prompt if you want stonehearth in that same language

that could also possible but i dont think that we need so much work :wink: because radiant will add the languages later themself with the tested sizes ^^

so i wanted to hold it simple xD

Yea my thoughts too, eventually I assume there will be steam workshop for steam users too…maybe

1 Like

I don’t think you can use an if statement in json. It’s just a data format. It’s not code in any way.

Also, why do you need it? As long as you have all the language files in the one mod and correctly linked in the manifest, you’ll be able to select any of the languages from in game as you like. Are there a few words here and there that are not fully internationalized? In that case it seems better to just get those bits fixed.

1 Like

yes like mentioned for different languages you need different overrides ^^ so i wanted to set when ger is language then use following overrides ^^

I’m not sure how it’s done, but the only way to set up some conditional overrides would be in the code that reads the json files. Either in lua or the c++ that does that job. That seems really intrusive for a translation mod.

If you need to define the font to use with a specific translation, than that seems best served as a feature request. Being able to do something like “font” : “fonts/my_font” at the start of a translation file instead of having to directly override the games standard font would be nice right?

What other files would you need to override based on which language it is?

ok i see with json its not possible and i will stand with my normal one language mod ^^

for your question it must override some other ui json because of size etc ^^


hmm… dont know if this is too late or not, but perhaps @Drotten could help you?

(i also just changed the topic to scripting & code as it seemed more fitting.)

1 Like

I don’t actually have anything more to add to this than what Tuhalu already mentioned above, but thanks for paging me all the same. :smile: