Open brodkin opened 2 years ago
It is something I'm planning to look into. Giving it a quick look though I'm not sure I can properly export it through a mod. Basically, everything contains an optional localisation identifier (much like an item's name) that I can expose (would just have to handle the "optional" part somehow). However, converting that into "human readable" localised text isn't quite as straightforward from a mod's perspective.
As far as I can tell, the only way I can programmatically export the text for a specific language is through a player object. Basically, this would mean starting up the game completely, setting the game's locale as desired, and then starting a (temporary) map where I can push all known localisation strings through to put it in a different output file (since we're in a different stage in the game this cannot be joined with the other data).
Either that, or you'd have to utilise the localisation identifier directly and just figure out the correct translation based on all of the localisation files yourself.
I'm not even sure that you could use the player because you might not be able to grab the item's name if it has not been researched. How does the localisation identifier compare to the item name?
The research bit won't be a limitation. The player object from a LUA (i.e. modding) point of view will have full control. Even if research is a problem, you can always just run some functions to mark everything as researched (just like you can do with the console).
Regarding the localisation identifier, it's effectively the same as the name with some additional stuff, so you're better off with the name property.
Did some more digging and extracting this indeed won't be pretty. The only way to extract localisation is basically what I mentioned previously:

 

For now I'm looking if it's possible to have this mod handle this semi-automatically with some input. An possible description of the process would be:

 

Like I said. It won't be pretty, but other than manually implementing localisation yourself I currently don't see another method.
You are correct. That is both well-researched and not at all pretty.
I did manage to find this mod, which afaict exports everything in a special JSON format as well (including icons through an atlas). So you might be able to use that. It's a bit more manual in its usage, though (haven't yet checked yet if there's a method to automate joining a level through console parameters).
In case you're interested in the technical details for how the above mod handles translation: it uses Flib for extracting the translation, which roughly uses the method I outlined, + a whole lot of smart stuff which it uses to return all the latent calls' result in a single object once it's done.
I'm not a modder, but I do consume JSON output from mods like yours. Any chance that you'd consider extracting the translated names of the items, and not just the hyphenated names? Many mods change the names of the recipes, resulting in the name of the item shown in-game to mismatch the hyphenated name. It makes this data much harder to consume.
If not, totally respect that, but I'd love any thoughts you have on how it might be accomplished.
FWIW I'm consuming JSON data here... https://bitbucket.org/gkrb/jiratorio/