Localisation in log files

Things that we aren't going to implement
Post Reply
ActionJackson
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 24, 2016 6:00 pm
Contact:

Localisation in log files

Post by ActionJackson »

Hello!

I'm working on a fun pet project that allows for traversing items and recipes via a web interface, with the ultimate goal being you can load in whatever mods you are using and create a dump of the information I need from items and recipes to a log file from within factorio. I take that data and upload it to my site, parse it, and make a snazzy GUI that can show you how to make whatever item, what assembling machine it takes, recipe info, etc. For a days work, it works pretty well but I'm not near ready enough to post it anywhere. But I did come across one problem...

The LuaEntityPrototype class "localisation_name" (and similarly in LuaRecipePrototype) does not contain any useful information. I'd love to be able to pull the localisation out so I don't have to copy and paste from a ton of .cfg files and build my localisations that way. It seems... unreliable doing it that way.

Recommendation:

Add localisation_names to Lua*Prototype objects to contain a key/value pair of "language" to "definition"...
CODE: SELECT ALL

Code: Select all

game.entity_prototypes[x].localisation_names = { "en" : "Foo", "de" : "Bar", "ga-IE" : "Bash" } etc
(pardon me if this incorrect syntax but it's late and I'm very tired :D )

with that I'd be able to pull the language(s) that I want to include for a given item, recipe, tile, etc

Similarly, if I'm missing something please feel free to let me know if this possible and I've missed it.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Localisation in log files

Post by Rseding91 »

As talked about on Discord you can write directly to the file using the localised_name and it will output the translation. The actual translation is not available for mods due to determinism.
If you want to get ahold of me I'm almost always on Discord.

ActionJackson
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 24, 2016 6:00 pm
Contact:

Re: Localisation in log files

Post by ActionJackson »

Well you can log() the name, but not write it to a file with game.write_file

that's why i was suggesting a table of all loaded localisations and i can pick the one i want after that with a simple comparison. I have what I need for now, it's just not ideal.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Localisation in log files

Post by Rseding91 »

ActionJackson wrote:
Thu Jan 03, 2019 7:33 pm
Well you can log() the name, but not write it to a file with game.write_file

that's why i was suggesting a table of all loaded localisations and i can pick the one i want after that with a simple comparison. I have what I need for now, it's just not ideal.
viewtopic.php?f=3&t=60548
0.16.44 Changelog wrote:* Added support for localised strings in LuaGameScript::write_file.
If you want to get ahold of me I'm almost always on Discord.

ActionJackson
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 24, 2016 6:00 pm
Contact:

Re: Localisation in log files

Post by ActionJackson »

Thanks!

Post Reply

Return to “Won't implement”