API call to localize string
Posted: Thu May 04, 2017 1:42 am
I'm programatically creating clones of existing prototypes in the game. However, this requires me to name them differently, which breaks localization. I've come up with 5 possible solutions (3 of which would require a change from the game):
1. When data:extend() is called, immediately localize, and then add it to the prototype.
2. Allow me to call a function to localize an arbitrary string. I believe in this post Rseding said it could lead to desync issues, but that doesn't make sense to me, because I have access to localised strings at control.lua time, so I can desync anyways off of that data.
3. Allow wildcards when matching names in localization. This way I can have `furnace-1` and `furnace-2` both be localized to the same thing.
4. Add an attribute "localizing_name" which is the name it will use to localize the item.
5. I simply take the name of the prototype and programatically generate an English localized name.
(For context, this is why I'm creating clones of existing prototypes)
1. When data:extend() is called, immediately localize, and then add it to the prototype.
2. Allow me to call a function to localize an arbitrary string. I believe in this post Rseding said it could lead to desync issues, but that doesn't make sense to me, because I have access to localised strings at control.lua time, so I can desync anyways off of that data.
3. Allow wildcards when matching names in localization. This way I can have `furnace-1` and `furnace-2` both be localized to the same thing.
4. Add an attribute "localizing_name" which is the name it will use to localize the item.
5. I simply take the name of the prototype and programatically generate an English localized name.
(For context, this is why I'm creating clones of existing prototypes)