[Bf-blender-cvs] [45ae33a9524] master: Fix T66731: Part 3: Labels translations when tools are in 'compact' mode.
Bastien Montagne
noreply at git.blender.org
Tue Aug 6 12:21:56 CEST 2019
Commit: 45ae33a9524153376d1df66a69d7a162c28e336c
Author: Bastien Montagne
Date: Tue Aug 6 12:18:42 2019 +0200
Branches: master
https://developer.blender.org/rB45ae33a9524153376d1df66a69d7a162c28e336c
Fix T66731: Part 3: Labels translations when tools are in 'compact' mode.
Very annoying that this whole UI thingy uses its own cooking... This is
more a quick-slap fix than a proper solution, would expect it to work in
nearly all cases though...
===================================================================
M source/blender/editors/interface/interface_region_tooltip.c
===================================================================
diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c
index 5dd8b74aceb..6aad9e41e7d 100644
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@ -396,11 +396,23 @@ static uiTooltipData *ui_tooltip_data_from_tool(bContext *C, uiBut *but, bool is
else {
/* Note, this is an exceptional case, we could even remove it
* however there have been reports of tooltips failing, so keep it for now. */
- expr_result = BLI_strdup("Internal error!");
+ expr_result = BLI_strdup(IFACE_("Internal error!"));
is_error = true;
}
if (expr_result != NULL) {
+ /* NOTE: This is a very weak hack to get a valid translation most of the time...
+ * Proper way to do would be to get i18n context from the item, somehow. */
+ const char *label_str = CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, expr_result);
+ if (label_str == expr_result) {
+ label_str = IFACE_(expr_result);
+ }
+
+ if (label_str != expr_result) {
+ MEM_freeN(expr_result);
+ expr_result = BLI_strdup(label_str);
+ }
+
uiTooltipField *field = text_field_add(data,
&(uiTooltipFormat){
.style = UI_TIP_STYLE_NORMAL,
@@ -437,7 +449,7 @@ static uiTooltipData *ui_tooltip_data_from_tool(bContext *C, uiBut *but, bool is
else {
/* Note, this is an exceptional case, we could even remove it
* however there have been reports of tooltips failing, so keep it for now. */
- expr_result = BLI_strdup("Internal error!");
+ expr_result = BLI_strdup(TIP_("Internal error!"));
is_error = true;
}
More information about the Bf-blender-cvs
mailing list