i18n: do not translate obect mode enum and transform orientation enum if UI translati...
[blender.git] / source / blender / editors / interface / interface_regions.c
index e673add46b1b87f111b18fc232124510842f0350..208babe2058af2acf03e4c67760c616d3a488f82 100644 (file)
@@ -343,6 +343,7 @@ static void ui_tooltip_region_free_cb(ARegion *ar)
        ar->regiondata= NULL;
 }
 
+#define U_(msgid) (((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS))?BLF_gettext(msgid):(msgid))
 ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 {
        uiStyle *style= UI_GetStyle();
@@ -403,7 +404,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                prop= (but->opptr)? but->opptr->data: NULL;
 
                if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
-                       BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), _("Shortcut: %s"), buf);
+                       BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Shortcut: %s")), buf);
                        data->color[data->totline]= 0x888888;
                        data->totline++;
                }
@@ -413,7 +414,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                /* full string */
                ui_get_but_string(but, buf, sizeof(buf));
                if(buf[0]) {
-                       BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Value: %s", buf);
+                       BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Value: %s")), buf);
                        data->color[data->totline]= 0x888888;
                        data->totline++;
                }
@@ -425,7 +426,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                if (unit_type == PROP_UNIT_ROTATION) {
                        if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
                                float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop);
-                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", value);
+                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Radians: %f")), value);
                                data->color[data->totline]= 0x888888;
                                data->totline++;
                        }
@@ -434,7 +435,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                if(but->flag & UI_BUT_DRIVEN) {
                        if(ui_but_anim_expression_get(but, buf, sizeof(buf))) {
                                /* expression */
-                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Expression: %s", buf);
+                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Expression: %s")), buf);
                                data->color[data->totline]= 0x888888;
                                data->totline++;
                        }
@@ -442,7 +443,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 
                /* rna info */
                if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
-                       BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
+                       BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Python: %s.%s")), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
                        data->color[data->totline]= 0x888888;
                        data->totline++;
                }
@@ -450,7 +451,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                if(but->rnapoin.id.data) {
                        ID *id= but->rnapoin.id.data;
                        if(id->lib && id->lib->name) {
-                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Library: %s", id->lib->name);
+                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Library: %s")), id->lib->name);
                                data->color[data->totline]= 0x888888;
                                data->totline++;
                        }
@@ -465,7 +466,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 
                /* operator info */
                if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
-                       BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str);
+                       BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Python: %s")), str);
                        data->color[data->totline]= 0x888888;
                        data->totline++;
                }
@@ -479,7 +480,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                        WM_operator_poll_context(C, but->optype, but->opcontext);
                        poll_msg= CTX_wm_operator_poll_msg_get(C);
                        if(poll_msg) {
-                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Disabled: %s", poll_msg);
+                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Disabled: %s")), poll_msg);
                                data->color[data->totline]= 0x6666ff; /* alert */
                                data->totline++;                        
                        }
@@ -489,7 +490,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
                        if(but->menu_create_func && WM_menutype_contains((MenuType *)but->poin)) {
                                MenuType *mt= (MenuType *)but->poin;
-                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", mt->idname);
+                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), U_(N_("Python: %s")), mt->idname);
                                data->color[data->totline]= 0x888888;
                                data->totline++;
                        }
@@ -608,6 +609,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 
        return ar;
 }
+#undef U_
 
 void ui_tooltip_free(bContext *C, ARegion *ar)
 {