Page 1 of 1

[Genhis] [1.1.73] Locale fallback groups do not work on captions or tooltips set after creation

Posted: Fri Dec 02, 2022 7:29 am
by raiguard
If you create a GUI element, then later change its caption or tooltip, locale fallback groups are not parsed. They only work when setting the caption or tooltip on initial creation of the GUI element.

To reproduce:
Run this command:

Code: Select all

/c game.player.gui.top.add{type = "button", caption = {"?", {"item-name.ice-cream"}, "no ice cream"}} game.player.gui.top.add{type = "button", name = "test"} game.player.gui.top.test.caption = {"?", {"item-name.ice-cream"}, "no ice cream"}
The first button will correctly show no ice cream, but the second button will show Unknown key: "?".

Re: [Genhis] [1.1.73] Locale fallback groups do not work on captions or tooltips set after creation

Posted: Fri Dec 02, 2022 8:59 am
by Honktown
Adding: it also doesn't work in just game.print:

Code: Select all

/c game.print({"?",{"item-name.ice-cream"},"no ice cream"})

Re: [Genhis] [1.1.73] Locale fallback groups do not work on captions or tooltips set after creation

Posted: Fri Dec 02, 2022 12:15 pm
by jan1i3
Based on this I recognize a pattern that is probably relevant: in LuaGuiElement.add the entire structure gets converted to a PropertyTree first, including the localised string. Assigning to LuaGuiElement.caption doesn't do that, neither does game.print, neither do most things (edit: that take localised strings), so these are most likely 2 different parse functions.

Re: [Genhis] [1.1.73] Locale fallback groups do not work on captions or tooltips set after creation

Posted: Sat Dec 03, 2022 11:48 am
by Genhis
Thanks for the report. This and other issues with fallback group parsing are fixed for the next release.