[Genhis] [1.1.74] Locale fallback doesn't work inside template key
Posted: Mon Dec 19, 2022 12:31 am
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:
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:
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.
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'}}
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'}}
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.