aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GUILabel.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-09-20 18:50:25 +0200
committer GitHub <noreply@github.com>2024-09-20 18:50:25 +0200
commitb6256b7c90e71085b06116575b36181883db5a48 (patch)
treea7959840d5332abbbbeeef24a6322b215d1beaeb /extension/src/openvic-extension/classes/GUILabel.cpp
parent8f0538b74fd274721a3178bff9b1294a71af3431 (diff)
parentb78093041d877ef30c2d17878cc03fd30c4b229c (diff)
Merge pull request #274 from OpenVicProject/rule-modifier-tooltips
Add RuleSet and ModifierValue tooltip making functions
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();
}