Remove the length limit on string literals in localised strings

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 843
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

Remove the length limit on string literals in localised strings

Post 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
curiosity
Filter Inserter
Filter Inserter
Posts: 570
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

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

Post 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.
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 843
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

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

Post 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.
Post Reply

Return to “Modding interface requests”