Page 1 of 1

Locale files can't have spaces after variable names anymore.

Posted: Mon Jul 09, 2018 5:36 pm
by eradicator
(Not sure if this is a bug/feature/etc. Feel free to move.)

While trying to update an old 0.13 mod i noticed that in 0.13 local.cfg files used to allow spaces after the variable name. But in 0.16 the game will throw "unknown-key:" for any such occurance. It think the locale files are much more readable with spacing, so it'd be nice if this would work again.
spacing.png
spacing.png (26.08 KiB) Viewed 767 times

Re: Locale files can't have spaces after variable names anymore.

Posted: Tue Jul 10, 2018 7:56 am
by bobingabout
It was a non-standard feature of the ini/config file format to begin with, by removing spaces, they're just bringing it closer to a conforming standard.

Why do it when they did? I dunno, maybe they changed to use a different parser that doesn't allow this non-standard configuration.

Re: Locale files can't have spaces after variable names anymore.

Posted: Tue Jul 10, 2018 11:43 am
by eradicator
bobingabout wrote:maybe they changed to use a different parser that doesn't allow this non-standard configuration.
That is my suspicion too. But it really makes the files difficult to work with when they're just an unformatted blob of text (and i have to handle 3 languages on my own here). I see the thread was moved to "suggestions", so i guess i'll have to write me a script that automatically strips the space on my end if i want that feature back.

Code: Select all

s/\s*=\s*/=/

Re: Locale files can't have spaces after variable names anymore.

Posted: Wed Jul 11, 2018 8:42 am
by bobingabout
When I was trying to write my own game, I wrote something called initool. It's a Dif tool for ini files, to merge them together. Because I literally wrote everything by myself, it includes truncation, stripping out all spaces before a tag, before and after the =, and at the end of line, including removing all comments.

The main reason it does that is because this is part of the game engine itself, so only keeps the information it can use, in a format it can use, but it can output the information too.

one of the things it should be able to do is strip down a locale file in Factorio.

I haven't tested it with anything other than standard ASCII though, so it might not work with any extended characters.
https://www.dropbox.com/sh/6v2ckwti6dqf ... 9KdAa?dl=0
There is a difference, I can't remember what it is.

It's a command line tool, so, open a command prompt and run it, I'm fairly sure it will report the commands on how to use it as an error message.
(last edit date, 6 years ago yesterday. don't expect me to remember how to use it)

Keep in mind... Why do I mod factorio? I was writing my own game, suffered a hard drive crash and lost over a months worth of work. So I wanted to do something else for a while to do to take my mind off the failure, so started modding Factorio. I haven't gone back yet.

Re: Locale files can't have spaces after variable names anymore.

Posted: Wed Jul 11, 2018 9:54 am
by eradicator
bobingabout wrote:Keep in mind... Why do I mod factorio? I was writing my own game, suffered a hard drive crash and lost over a months worth of work. So I wanted to do something else for a while to do to take my mind off the failure, so started modding Factorio. I haven't gone back yet.
That sounds pretty familiar. Except i didn't lose anything. I just felt that some more experience was required :D.
Also while i thank you for the offer, if i'm going to use a special parser for that i'd rather write my own one that perfectly fits my needs (and give myself a reason to not have my regex knowledge rust too much ;).
The problem with using a personal pre-parser is mostly that i'm the only one benefiting from it. Any potential helpful user that wants to translate to his own language...would still have to use the "raw" version that is provided in the zip file.