add '@' prefix support to tooltips

This commit is contained in:
MihailRis 2025-03-11 16:19:33 +03:00
parent 9286f297c1
commit fa990e3939

View File

@ -158,7 +158,13 @@ static void read_uinode(
} }
if (element.has("tooltip")) { if (element.has("tooltip")) {
node.setTooltip(util::str2wstr_utf8(element.attr("tooltip").getText())); auto tooltip = util::str2wstr_utf8(element.attr("tooltip").getText());
if (!tooltip.empty() && tooltip[0] == '@') {
tooltip = langs::get(
tooltip.substr(1), util::str2wstr_utf8(reader.getContext())
);
}
node.setTooltip(tooltip);
} }
if (element.has("tooltip-delay")) { if (element.has("tooltip-delay")) {
node.setTooltipDelay(element.attr("tooltip-delay").asFloat()); node.setTooltipDelay(element.attr("tooltip-delay").asFloat());