Page 1 of 1

Comments Only in locale file crashes Factorio

Posted: Sun May 01, 2022 4:06 pm
by hackamod
An otherwise empty locale file causes Factorio to crash with the message:
Failed to load mods: Failed to load locale: Missing value at __EmptyMod__/locale/en/en_us.cfg
Mod Folder Contents:
  • info.json
  • locale.en.en_us.cfg
Contents of en_us.cfg:
--en-us.cfg
--introduced 0.0.0
--This file contains translations to United States English
If there are values in the file that are used, it does not crash.
Adding values that are not used does not help, it still crashes.
Removing the comments from the empty template (leaving just the empty file) does prevent the crash.
This is an empty template only, the mod contains nothing but the 2 files info.json and en_us.cfg in the locale/en folder.

Re: Comments Only in locale file crashes Factorio

Posted: Thu May 05, 2022 7:39 pm
by hackamod
Upon further inspection, due to a bug, the comments were not being printed in the (auto-generated) locale file.
The only time it works is when there is only one comment, which is treated as a key to a value if that comment happens to contain the = character

-- [font=default-bold]\nAKA /\n@usage: /[/font]

I was looking over the Localisation Tutorial and did not see any mention of it, but it appears that comments are not allowed in this file.
Have I missed something somewhere else that mentions this?
Perhaps this should be mentioned in the tutorial page as well if it is the case that comments are not allowed in this file?

...Not mad, just have to adjust how I generate this.
What are the chances of ignoring comments here like the rest of the files?
I really do like the file name, version, and sometimes other things in the header.... if not a bug, perhaps a request/suggestion then?

Re: Comments Only in locale file crashes Factorio

Posted: Thu May 05, 2022 7:57 pm
by boskid
Thanks for the report. There are no bugs here. Ini file comments start with "#" or ";". Usage of "--" is not supported as a comment start.

Re: Comments Only in locale file crashes Factorio

Posted: Thu May 05, 2022 8:13 pm
by hackamod
boskid wrote: Thu May 05, 2022 7:57 pm Ini file comments start with "#" or ";". Usage of "--" is not supported as a comment start.
Thank you.