Handle quoted translations in locale files / follow the INI specification

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Raiguard
Filter Inserter
Filter Inserter
Posts: 357
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Handle quoted translations in locale files / follow the INI specification

Post by Raiguard »

Greetings,

I've been using Crowdin to translate Krastorio 2, using Crowdin's GitHub action to do the synchronization. It's been working pretty well! However, in order for Crowdin to provide a good translation interface, the action renames the files to .ini. The problem is, Factorio does not follow the INI standard.

Crowdin, following the INI spec, will automatically add quotes around any value that has special characters (#;=) in it. For example:

Code: Select all

# Before:
my-rich-text=[color=255,0,0]Red[/color]
# After:
my-rich-text="[color=255,0,0]Red[/color]"
However, Factorio will happily show the quotes in-game instead of removing them.

There is another problem: Crowdin, following the INI spec, will consider anything between a semicolon and EOL to be a comment. So if you have a translation such as:

Code: Select all

my-semicolon=The way; this way!
Only The way will show up in Crowdin as translateable. ; this way! will be treated as a comment. This is fixed by quoting the translation, but then Factorio does not handle those properly.

My current plan is to put together some scripts to convert the source files to have quotes around every translation, then call the Crowdin action, then call another script to remove those quotes in the files that Crowdin returns. However, this is far from an ideal solution. I would like to request that Factorio properly follow the INI spec for locale files so this issue doesn't even come up. Barring that, if Factorio could handle the quotes around translations, that would be plenty.
Don't forget, you're here forever.

curiosity
Fast Inserter
Fast Inserter
Posts: 174
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Handle quoted translations in locale files / follow the INI specification

Post by curiosity »

There is no "INI specification". The format is not standardized. You can request the support of quoted values, but requesting to follow the INI specification makes no sense. Alternatively, you can say "Crowdin's INI specification", since it sounds like Crowdin has a specific set of features it implements (listed where?).

Post Reply

Return to “Modding interface requests”