Comments Only in locale file crashes Factorio

Bugs that are actually features.
Post Reply
hackamod
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Mon Apr 25, 2022 2:39 pm
Contact:

Comments Only in locale file crashes Factorio

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

hackamod
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Mon Apr 25, 2022 2:39 pm
Contact:

Re: Comments Only in locale file crashes Factorio

Post 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?

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Comments Only in locale file crashes Factorio

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

hackamod
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Mon Apr 25, 2022 2:39 pm
Contact:

Re: Comments Only in locale file crashes Factorio

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

Post Reply

Return to “Not a bug”