diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-08-06 13:18:42 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-08-06 13:18:42 +0300 |
commit | 45ae33a9524153376d1df66a69d7a162c28e336c (patch) | |
tree | 46f6741c21b36182fbafb6d01302fd73f09c41db | |
parent | 785301e5acfbf55208655aba80cde5b2d7b2ee44 (diff) |
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...
-rw-r--r-- | source/blender/editors/interface/interface_region_tooltip.c | 16 |
1 files changed, 14 insertions, 2 deletions
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; } |