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...
This commit is contained in:
Bastien Montagne 2019-08-06 12:18:42 +02:00
parent 785301e5ac
commit 45ae33a952
Notes: blender-bot 2023-02-14 07:30:31 +01:00
Referenced by issue #66731, Translated texts remain original english
1 changed files with 14 additions and 2 deletions

View File

@ -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;
}