Page 1 of 1

Remove the length limit on string literals in localised strings

Posted: Sun Jan 05, 2025 2:14 pm
by IsaacOscar
Bassically, for some reason if you try and do prototype.localised_name = {"some.key", str}, the length of 'str' is limited to 200 characters.
For example, you could get this error:

Code: Select all

Localised string key is too large: 201 > 200 (limit). in property tree at ROOT.recipe.basic-oil-processing.localised_name[2]
I understand having this limit for localised keys, but programmatically generating text with more than 200 characters seems reasonable. Especially as there is no such limit in the values in the locale file, e.g.

Code: Select all

[some]
key=... really long string ...
But mods can't generate locale files!

I have found a workaround to the above problem by nesting {"", ...} locale keys, but it's not simple, as there's a limit of 19 paramater's to the "".
Complicated Code

Re: Remove the length limit on string literals in localised strings

Posted: Sun Jan 05, 2025 2:30 pm
by curiosity
That's weird, since there is no such restriction at runtime.

But I guess you shouldn't be dealing in unlocalized strings right there, that defeats the point of localization.

Re: Remove the length limit on string literals in localised strings

Posted: Sun Jan 05, 2025 2:37 pm
by IsaacOscar
curiosity wrote: Sun Jan 05, 2025 2:30 pm That's weird, since there is no such restriction at runtime.
Your right, game.print{"", ("x"):rep(300)} works.
curiosity wrote: Sun Jan 05, 2025 2:30 pm But I guess you shouldn't be dealing in unlocalized strings right there, that defeats the point of localization.
In my case, the strings where actually just [ img=... ] things, so they don't need to be translated.