locale automatic generation ?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

locale automatic generation ?

Post 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 ?
My mods on the Factorio Mod Portal :geek:

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: locale automatic generation ?

Post 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.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: locale automatic generation ?

Post 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.
My mods on the Factorio Mod Portal :geek:

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: locale automatic generation ?

Post 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'.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: locale automatic generation ?

Post 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

Post Reply

Return to “Modding help”