Fluid and technology built-in parameters
Fluid and technology built-in parameters
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
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.
If you want to get ahold of me I'm almost always on Discord.
Re: Fluid and technology built-in parameters
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
No, they're done live every time a locale is translated to be shown; since locale can change depending on the scenario being played.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.
If you want to get ahold of me I'm almost always on Discord.
Re: Fluid and technology built-in parameters
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
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
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.