How localizations work? I'm having some problems

I have in the Archipelago mod two languages already build in, english (as default, en.json) and portuguese (pt-BR.json).

I then have installed a portuguese language mod.
The portuguese mod adds two portuguese variations, one from Brazil (pt-BR) and one from Portugal (pt-PT).
It does not translate the Archipelago texts, just adds the languages to be chosen in the menu. The Archipelago itself is the one with the portuguese strings.

When I select in the menu the portuguese language (Brazil variation) it works, the archipelago gets translated.
But when I select the Portugal variation it does not.

I thought the game would follow this sequence:

pt-BR.json - the language you want, from the country you want.
pt.json - the language you want, without specific region.
en.json - if nothing is found, fall back to english.

But that was not the case. Because when I renamed my pt-BR,json to pt.json (from the Archipelago), hoping it would load for both Portugal and Brazil versions, it did not. Both languages were falling back to english.

Shouldn’t a locale named pt.json be accepted by both languages variations? (Following that sequence)

hmm for the codes pt-BR and pt-PT are the correct codes Table of Language Culture Names, Codes, and ISO Values Method [C++] … what happens when you change the pt-PT to pt-Br does it work then?

and for pt nope the system search for the Language Culture Names … an pt isnt included^^

If in the archipelago the locale file is named pt-BR.json, it works with the pt-BR language selected, but not with the pt-PT language.
If I rename the locale to pt.json, it fails in both.

As my observatoin, it only search the language defined in the added_languages.json, which is pt-PT.
I don’t think the game will search for pt.json when there is no pt-PT.json.
When I modify pt-PT to just pt in added_languages.json, the game will search for pt.json instead of pt-PT.json.

thats correct you must have both pt-Br and pt-PT in the added_langugages … but i think he has done this already because without this it would find his pt-BR xD

The language mod adds both pt-PT and pt-BR translation to stonehearth only, not to the archipelago. Not made by me.
In the archipelago there is only a pt-BR.json that I made myself (and the en.json), it is not from the language mod.
The archipelago works when the chosen language is set to pt-BR, but not with the pt-PT. That’s why I renamed the archipelago language file to pt.json. But it didn’t worked. I could simple copy the pt-BR content and create a clone file named pt-PT, then it would work in both. But that is not how it should be.

The correct behavior (from what I think is correct) is to load the pt-BR.json file if possible, if not, look for pt.json. Then if that also fails, just load the en.json.

ok before we do longer riddling - could you pm with with an link to your mod with both language files in it? ^^

I must say there is nothing special in the mod. It is just adding the languages which have just a few strings translated. The pt-PT version has nothing in it yet, but that should have no effect in my problem.

If you have selected the language pt-BR and a mod has a locale file pt.json, it should load that, unless it has a more specific locale file named pt-BR, which it should then load this one instead. If it has neither, then and only then it should load the en.json

ok quick test with only the stonehearthfiles (and i have replaced the ptfile because it was normal english) - works without any issues ^^

edit: test it with all files - in the menu it changes all after languages changes … so i must check it ingame but when the mainmenu works it should also work ingame ^^ Dropbox - Traslater-portugues.smod

I think you are missing the point… I even told that the pt version have nothing only english.

Try this, rename the pt-BR.json in the archipelago mod to pt.json and load the game with any portuguese language. It will not work. Simple.

ok thats normal because pt is no lcid languagecode ^^ i have understand that it doenst use the pt-pt version so that you wanted to change it to pt only ^^

stonehearth only accept LCID strings

That does not look right.
That looks like a Windows thing, and the game does not need to follow that standard.
And according to that table the en.json in the game right now would not work, as it would need to be changed to en-US.json
Your german translation have de.json files, which according to that would also not work, only the de-de.json.

I’m thinking more about this

I remember seen a comment in one of the game files where this was explained, but I can’t find it anymore.

Can a dev take a look at this to confirm or deny this behaviour?

I always thought that a language should be loaded by any corresponding language pack, no matter the country code. So the pt.json would be loaded by any pt-XX.json.

And the reason for a country code were just for the small cases like a string is different in a another country. Like the word color in america is write as colour in europe.
You should not need a whole en-GB.json file just because one word changed, you would just add the necessary strings to it, and everything else would fallback to the default english language.

I might be wrong, but I feel like this is happening because the localization is just a mod. So all the localized strings are prefixed, if you use a different prefix, it will search for them in the mod named like that prefix, it can’t search by pattern.

Let me ask devs if this is something that should be working differently.

Ok, thanks. It is not really a big issue by the way, as we can simple double the language file to get it compatible with both countries, I just thought it was an unnecessary extra step.

1 Like