Page 1 of 1

locale automatic generation ?

Posted: Sat Apr 23, 2016 8:41 pm
by binbinhfr
Hi,

in my mod, I generate automaticaly a list of item/recipe/entity where only the suffix changes.
For example, let say a list of Chest-[color] from a list of colors that can be edited.
So I ended with Chest-white, Chest-black, Chest-green, etc...
And I want to give a locale name to these chests.
So, if I have the locale string for Chest, is there a way to generate all the needed locale, ie. :
chest-black = Chest of color black
and also
chest-black = Coffre de couleur noire

etc...

so can we generate cfg files from lua ?
or can we put lua into cfg files to automate generation of strings ?

Re: locale automatic generation ?

Posted: Sat Apr 23, 2016 9:26 pm
by Adil
No you can't generate locale. I put interface request on that a while ago don't remember what happened to it. Feel free to open another one. ;)

In your case, however, I take it that you know all the locale component words. So you could probably use either external programs or factorio's game.write_file() to output cfg and then put that into your mod's folder.

Re: locale automatic generation ?

Posted: Sat Apr 23, 2016 11:17 pm
by binbinhfr
Thanks for your help.

Using game.write_file() write in script-output only, right ? So I would still have to move the file manually and then rerun factorio. That's ok for me, but not for users of the mod... I'd like this to be automatical, depending on the config file the user could write/change.

Re: locale automatic generation ?

Posted: Sun Jul 10, 2016 8:20 am
by DRY411S
It would be good if we could 'inherit' existing locale strings. I have the same challenge as you with my Recycling Mod.

Maybe a special character in a name that tells factorio to concatenate locale strings together?

So in your case "Chest+black" would ask factorio to concatenate the locale for 'chest' and the locale for 'black'.

Re: locale automatic generation ?

Posted: Tue Jul 12, 2016 4:10 pm
by DRY411S
I've been given some great advice on this by Mooncat. It is possible using an unpublished property called 'localised_name' to build 'dynamic' locale.

viewtopic.php?f=97&t=26039&p=183183#p183183