Page 1 of 1

Fluid and technology built-in parameters

Posted: Tue Jul 21, 2020 2:58 am
by alercah
According to jarg, the regex for matching built-in parameters that reference other localisation strings is "__((ALT_)?CONTROL(_MOVE)?|ENTITY|ITEM|TILE)__.+?__". This is missing, at the very least, fluids and technologies. These should be added in.

Re: Fluid and technology built-in parameters

Posted: Tue Jul 21, 2020 9:59 pm
by Rseding91
I believe the reason these don't exist is every added one makes every translated string shown in the game slower since it has to check if any of the possible replacements exist in the string.

Re: Fluid and technology built-in parameters

Posted: Thu Jul 23, 2020 5:05 pm
by alercah
Is that not done only once when loading the locale files? In any case an optimized regex implementation should be very fast... but a good many are not optimized.

Re: Fluid and technology built-in parameters

Posted: Thu Jul 23, 2020 6:18 pm
by Rseding91
alercah wrote:
Thu Jul 23, 2020 5:05 pm
Is that not done only once when loading the locale files? In any case an optimized regex implementation should be very fast... but a good many are not optimized.
No, they're done live every time a locale is translated to be shown; since locale can change depending on the scenario being played.

Re: Fluid and technology built-in parameters

Posted: Thu Jul 23, 2020 10:17 pm
by alercah
My suggestion then would be to parse the strings only once, the first time on each game that you translate a string (or alternatively do one big pass before starting the game). Convert it into a structured representation that stores the offsets to replace with what, then refer to that when inserting dynamic parameters (parameters that don't change like these ones can probably be substituted in only once when it's loaded and not even made dynamic).

Re: Fluid and technology built-in parameters

Posted: Thu Nov 03, 2022 2:12 pm
by Bilka
Fluid was added to the built in parameters in 1.1.70. Note that since the first post in the thread, several new built-in parameters have been added. They are documented on the wiki: https://wiki.factorio.com/Tutorial:Loca ... parameters