aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GUILabel.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-09-19 00:12:41 +0200
committer hop311 <hop3114@gmail.com>2024-09-19 00:12:41 +0200
commit258bcc535da4ae040da63006b4b95cf113dca9ed (patch)
treeb782ee665bf6fd6e054415f4a9c3360db331b829 /extension/src/openvic-extension/classes/GUILabel.cpp
parentc26247464feabe0fbb9d6a8527b242d667faa066 (diff)
Add RuleSet and ModifierValue tooltip making functionsrule-modifier-tooltips
Diffstat (limited to 'extension/src/openvic-extension/classes/GUILabel.cpp')
-rw-r--r--extension/src/openvic-extension/classes/GUILabel.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/extension/src/openvic-extension/classes/GUILabel.cpp b/extension/src/openvic-extension/classes/GUILabel.cpp
index 7e93f01..3c7cfed 100644
--- a/extension/src/openvic-extension/classes/GUILabel.cpp
+++ b/extension/src/openvic-extension/classes/GUILabel.cpp
@@ -523,7 +523,16 @@ String GUILabel::generate_substituted_text(String const& base_text) const {
String value = substitution_dict.get(key, String {});
// Use the un-substituted key if no value is found or the value is empty
- result += value.is_empty() ? key : is_auto_translating() ? tr(value) : value;
+ if (value.is_empty()) {
+ value = key;
+ }
+
+ // Translate the value if auto-translating (even if it's the key after a failed substitution)
+ if (is_auto_translating()) {
+ value = tr(value);
+ }
+
+ result += value;
start_pos = marker_end_pos + get_substitution_marker().length();
}