[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45613] trunk/blender/source/blender: Fixed (or partly fixed) various missing UI translations, mainly with some specific ops invocations (popup menus?\226?\128?\166), and (to some extent) with the undo/redo stuff.

Bastien Montagne montagne29 at wanadoo.fr
Fri Apr 13 21:59:29 CEST 2012


Revision: 45613
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45613
Author:   mont29
Date:     2012-04-13 19:59:29 +0000 (Fri, 13 Apr 2012)
Log Message:
-----------
Fixed (or partly fixed) various missing UI translations, mainly with some specific ops invocations (popup menus?\226?\128?\166), and (to some extent) with the undo/redo stuff.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_layout.c
    trunk/blender/source/blender/editors/interface/interface_regions.c
    trunk/blender/source/blender/editors/util/CMakeLists.txt
    trunk/blender/source/blender/editors/util/SConscript
    trunk/blender/source/blender/editors/util/undo.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c

Modified: trunk/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_layout.c	2012-04-13 19:34:15 UTC (rev 45612)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c	2012-04-13 19:59:29 UTC (rev 45613)
@@ -1500,7 +1500,7 @@
 	if (layout->root->type == UI_LAYOUT_MENU && !icon)
 		icon = ICON_BLANK1;
 
-	ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, mt->description);
+	ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, TIP_(mt->description));
 }
 
 /* label item */
@@ -1618,7 +1618,7 @@
 	}
 
 	if (!name)
-		name = ot->name;
+		name = RNA_struct_ui_name(ot->srna);
 	if (layout->root->type == UI_LAYOUT_MENU && !icon)
 		icon = ICON_BLANK1;
 
@@ -1627,7 +1627,7 @@
 	BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname));
 	lvl->opcontext = layout->root->opcontext;
 
-	ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, ot->description);
+	ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, RNA_struct_ui_description(ot->srna));
 }
 
 static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)
@@ -2830,14 +2830,14 @@
 	}
 
 	if (flag & UI_LAYOUT_OP_SHOW_TITLE) {
-		uiItemL(layout, op->type->name, ICON_NONE);
+		uiItemL(layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
 	}
 
 	/* poll() on this operator may still fail, at the moment there is no nice feedback when this happens
 	 * just fails silently */
 	if (!WM_operator_repeat_check(C, op)) {
 		uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator cannot redo");
-		uiItemL(layout, "* Redo Unsupported *", ICON_NONE); // XXX, could give some nicer feedback or not show redo panel at all?
+		uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE); // XXX, could give some nicer feedback or not show redo panel at all?
 	}
 
 	/* menu */

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2012-04-13 19:34:15 UTC (rev 45612)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2012-04-13 19:59:29 UTC (rev 45613)
@@ -2068,12 +2068,13 @@
 	butwidth = width - UI_UNIT_X - 10;
 	
 	/* existence of profile means storage is in linear color space, with display correction */
+	/* XXX That tip message is not use anywhere! */
 	if (block->color_profile == BLI_PR_NONE) {
-		BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip));
+		BLI_strncpy(tip, N_("Value in Display Color Space"), sizeof(tip));
 		copy_v3_v3(rgb_gamma, rgba);
 	}
 	else {
-		BLI_strncpy(tip, "Value in Linear RGB Color Space", sizeof(tip));
+		BLI_strncpy(tip, N_("Value in Linear RGB Color Space"), sizeof(tip));
 		/* make an sRGB version, for Hex code */
 		linearrgb_to_srgb_v3_v3(rgb_gamma, rgba);
 	}
@@ -2101,11 +2102,11 @@
 	
 	/* mode */
 	uiBlockBeginAlign(block);
-	bt = uiDefButS(block, ROW, 0, "RGB", 0, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, "");
+	bt = uiDefButS(block, ROW, 0, IFACE_("RGB"), 0, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, "");
 	uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
-	bt = uiDefButS(block, ROW, 0, "HSV", width / 3, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, "");
+	bt = uiDefButS(block, ROW, 0, IFACE_("HSV"), width / 3, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, "");
 	uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
-	bt = uiDefButS(block, ROW, 0, "Hex", 2 * width / 3, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, "");
+	bt = uiDefButS(block, ROW, 0, IFACE_("Hex"), 2 * width / 3, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, "");
 	uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
 	uiBlockEndAlign(block);
 
@@ -2114,11 +2115,11 @@
 	
 	/* RGB values */
 	uiBlockBeginAlign(block);
-	bt = uiDefButR_prop(block, NUMSLI, 0, "R ",  0, -60, butwidth, UI_UNIT_Y, ptr, prop, 0, 0.0, 0.0, 0, 3, "Red");
+	bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("R "),  0, -60, butwidth, UI_UNIT_Y, ptr, prop, 0, 0.0, 0.0, 0, 3, TIP_("Red"));
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
-	bt = uiDefButR_prop(block, NUMSLI, 0, "G ",  0, -80, butwidth, UI_UNIT_Y, ptr, prop, 1, 0.0, 0.0, 0, 3, "Green");
+	bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("G "),  0, -80, butwidth, UI_UNIT_Y, ptr, prop, 1, 0.0, 0.0, 0, 3, TIP_("Green"));
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
-	bt = uiDefButR_prop(block, NUMSLI, 0, "B ",  0, -100, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, "Blue");
+	bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("B "),  0, -100, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, TIP_("Blue"));
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
 
 	// could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2126,16 +2127,16 @@
 	
 	/* HSV values */
 	uiBlockBeginAlign(block);
-	bt = uiDefButF(block, NUMSLI, 0, "H ",   0, -60, butwidth, UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, "Hue");
+	bt = uiDefButF(block, NUMSLI, 0, IFACE_("H "),   0, -60, butwidth, UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, TIP_("Hue"));
 	uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
-	bt = uiDefButF(block, NUMSLI, 0, "S ",   0, -80, butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, "Saturation");
+	bt = uiDefButF(block, NUMSLI, 0, IFACE_("S "),   0, -80, butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation"));
 	uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
-	bt = uiDefButF(block, NUMSLI, 0, "V ",   0, -100, butwidth, UI_UNIT_Y, hsv + 2, 0.0, max, 10, 3, "Value");
+	bt = uiDefButF(block, NUMSLI, 0, IFACE_("V "),   0, -100, butwidth, UI_UNIT_Y, hsv + 2, 0.0, max, 10, 3, TIP_("Value"));
 	uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
 	uiBlockEndAlign(block);
 
 	if (rgba[3] != FLT_MAX) {
-		bt = uiDefButR_prop(block, NUMSLI, 0, "A ",  0, -120, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, "Alpha");
+		bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("A "),  0, -120, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, TIP_("Alpha"));
 		uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
 	}
 	else {
@@ -2144,9 +2145,9 @@
 
 	BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
 
-	bt = uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)");
+	bt = uiDefBut(block, TEX, 0, IFACE_("Hex: "), 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)"));
 	uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol);
-	uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+	uiDefBut(block, LABEL, 0, IFACE_("(Gamma Corrected)"), 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 
 	rgb_to_hsv(rgba[0], rgba[1], rgba[2], hsv, hsv + 1, hsv + 2);
 
@@ -2651,7 +2652,7 @@
 	if (mt->poll && mt->poll(C, mt) == 0)
 		return;
 
-	pup = uiPupMenuBegin(C, mt->label, ICON_NONE);
+	pup = uiPupMenuBegin(C, IFACE_(mt->label), ICON_NONE);
 	layout = uiPupMenuLayout(pup);
 
 	menu.layout = layout;

Modified: trunk/blender/source/blender/editors/util/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/editors/util/CMakeLists.txt	2012-04-13 19:34:15 UTC (rev 45612)
+++ trunk/blender/source/blender/editors/util/CMakeLists.txt	2012-04-13 19:59:29 UTC (rev 45613)
@@ -20,6 +20,7 @@
 
 set(INC
 	../include
+	../../blenfont
 	../../blenkernel
 	../../blenlib
 	../../blenloader

Modified: trunk/blender/source/blender/editors/util/SConscript
===================================================================
--- trunk/blender/source/blender/editors/util/SConscript	2012-04-13 19:34:15 UTC (rev 45612)
+++ trunk/blender/source/blender/editors/util/SConscript	2012-04-13 19:59:29 UTC (rev 45613)
@@ -3,7 +3,7 @@
 
 sources = env.Glob('*.c')
 
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../makesrna ../../bmesh'
 incs += ' ../../blenloader'

Modified: trunk/blender/source/blender/editors/util/undo.c
===================================================================
--- trunk/blender/source/blender/editors/util/undo.c	2012-04-13 19:34:15 UTC (rev 45612)
+++ trunk/blender/source/blender/editors/util/undo.c	2012-04-13 19:59:29 UTC (rev 45613)
@@ -44,6 +44,8 @@
 #include "BLI_dynstr.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_blender.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
@@ -456,7 +458,9 @@
 		}
 		
 		if (name) {
-			item_tmp.identifier = item_tmp.name = name;
+			item_tmp.identifier = name;
+			/* XXX This won’t work with non-default contexts (e.g. operators) :/ */
+			item_tmp.name = IFACE_(name);
 			if (active)
 				item_tmp.icon = ICON_RESTRICT_VIEW_OFF;
 			else 
@@ -484,7 +488,7 @@
 		EnumPropertyItem *item = rna_undo_itemf(C, undosys, &totitem);
 		
 		if (totitem > 0) {
-			uiPopupMenu *pup = uiPupMenuBegin(C, op->type->name, ICON_NONE);
+			uiPopupMenu *pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
 			uiLayout *layout = uiPupMenuLayout(pup);
 			uiLayout *split = uiLayoutSplit(layout, 0, 0), *column = NULL;
 			int i, c;

Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2012-04-13 19:34:15 UTC (rev 45612)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2012-04-13 19:59:29 UTC (rev 45613)
@@ -666,7 +666,7 @@
 		return retval;
 	}
 	else {
-		pup = uiPupMenuBegin(C, IFACE_(op->type->name), ICON_NONE);
+		pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
 		layout = uiPupMenuLayout(pup);
 		uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
 		uiPupMenuEnd(C, pup);
@@ -700,7 +700,7 @@
 		RNA_property_enum_items((bContext *)C, &ptr, prop, &item_array, NULL, &do_free);
 
 		for (item = item_array; item->identifier; item++) {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list