[Genhis] [1.1.74] Locale fallback doesn't work inside template key

This subforum contains all the issues which we already resolved.
Post Reply
robot256
Filter Inserter
Filter Inserter
Posts: 607
Joined: Sun Mar 17, 2019 1:52 am
Contact:

[Genhis] [1.1.74] Locale fallback doesn't work inside template key

Post by robot256 »

I am trying to update Multiple Unit Train Control to use the new fallback groups with entity description keys.

I created a locale structure in data-updates.lua:

Code: Select all

loco.localised_description = {"?", {'template.mu-description',{"entity-description."..name}}, {'template.mu-description',{"item-description."..name}}, {'template.plain-mu-description'}}
For entities where entity-decription exists, this worked fine. For entities without entity-description, it populated "template.mu-description" with "Unknown key..." in place of the "__1__" field. I expected the fallback group to take effect when the nested entity-description string could not be found.

I then created a different locale structure based on the example in the forum post:

Code: Select all

loco.localised_description = {"?", {"",{'template.mu-description'},{"entity-description."..name}}, {"",{'template.mu-description'},{"item-description."..name}}, {'template.plain-mu-description'}}
This correctly detected when entity-description and item-description were invalid, and used "template.plain-mu-description". For entities with description, it returned the concatenated string, with "__1__" still in the string (as expected).

Therefore, it seems the fallback group logic is only checking for existence of the template locale string, and not the entries that should be substituted into it. Or is there a different syntax that should be used?

Edit: In my application, I could do what I wanted by converting it to just concatenation. But it could be a problem in other situations.

Genhis
Factorio Staff
Factorio Staff
Posts: 130
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [Genhis] [1.1.74] Locale fallback doesn't work inside template key

Post by Genhis »

Thanks, it's fixed for the next release. LocalisedString won't ignore 'correct' translation status of its parameters, so if one of them has unknown translation, the parent string will also be marked as not being correctly translated.

This could be considered as a breaking change which is why I hesitated with this fix for so long (and because a workaround existed).

Post Reply

Return to “Resolved Problems and Bugs”