[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45629] trunk/blender/source/blender: Fixed another bunch of i18n bugs (thx to Leon Cheung for spotting them), among which:

Bastien Montagne montagne29 at wanadoo.fr
Sat Apr 14 17:06:41 CEST 2012


Revision: 45629
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45629
Author:   mont29
Date:     2012-04-14 15:06:41 +0000 (Sat, 14 Apr 2012)
Log Message:
-----------
Fixed another bunch of i18n bugs (thx to Leon Cheung for spotting them), among which:
* Drag'n'drop translation in Outliner
* "Execute" button in file window
* "Labels" of spacing elements, in multi-column enums
* A glitch with nodes "Value to RGB", they where called "ColorRamp" in node_type_base() call. This is not definitive, though, as it appears that UI node names are determined by this call, while it should be by "defines" in rna_nodetrre_types.h, I guess... Anyway, not good to have such things in two different places!

Also moved default context name under BLF_translation.h, much better to have those all in one place, accessible from whole Blender code!

Modified Paths:
--------------
    trunk/blender/source/blender/blenfont/BLF_translation.h
    trunk/blender/source/blender/editors/space_file/file_draw.c
    trunk/blender/source/blender/editors/space_file/filesel.c
    trunk/blender/source/blender/editors/space_node/node_buttons.c
    trunk/blender/source/blender/editors/space_outliner/CMakeLists.txt
    trunk/blender/source/blender/editors/space_outliner/SConscript
    trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
    trunk/blender/source/blender/editors/util/CMakeLists.txt
    trunk/blender/source/blender/editors/util/SConscript
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
    trunk/blender/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
    trunk/blender/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
    trunk/blender/source/blender/windowmanager/WM_types.h
    trunk/blender/source/blender/windowmanager/intern/wm_dragdrop.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c

Modified: trunk/blender/source/blender/blenfont/BLF_translation.h
===================================================================
--- trunk/blender/source/blender/blenfont/BLF_translation.h	2012-04-14 12:03:23 UTC (rev 45628)
+++ trunk/blender/source/blender/blenfont/BLF_translation.h	2012-04-14 15:06:41 UTC (rev 45629)
@@ -67,6 +67,7 @@
 
 /* The "translation-marker" macro. */
 #define N_(msgid) msgid
+#define CTX_N_(context, msgid) msgid
 /* Those macros should be used everywhere in UI code. */
 #ifdef WITH_INTERNATIONAL
 /*	#define _(msgid) BLF_gettext(msgid) */
@@ -82,4 +83,18 @@
 	#define CTX_TIP_(context, msgid) msgid
 #endif
 
+/******************************************************************************
+ * All i18n contexts must be defined here.
+ * This is a nice way to be sure not to use a context twice for different
+ * things, and limit the number of existing contexts!
+ */
+
+/* Default, void context. Just in case... */
+#define BLF_I18NCONTEXT_DEFAULT ""
+
+/* Default context for operator names/labels. */
+#define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
+
+
+
 #endif /* __BLF_TRANSLATION_H__ */

Modified: trunk/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/file_draw.c	2012-04-14 12:03:23 UTC (rev 45628)
+++ trunk/blender/source/blender/editors/space_file/file_draw.c	2012-04-14 15:06:41 UTC (rev 45629)
@@ -223,11 +223,11 @@
 	
 	/* Execute / cancel buttons. */
 	if (loadbutton) {
-		
-		uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, IFACE_(params->title),
-			max_x - loadbutton, line1_y, loadbutton, btn_h, TIP_(params->title));
+		/* params->title is already translated! */
+		uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title,
+		          max_x - loadbutton, line1_y, loadbutton, btn_h, "");
 		uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, IFACE_("Cancel"),
-			max_x - loadbutton, line2_y, loadbutton, btn_h, TIP_("Cancel"));
+		          max_x - loadbutton, line2_y, loadbutton, btn_h, "");
 	}
 	
 	uiEndBlock(C, block);

Modified: trunk/blender/source/blender/editors/space_file/filesel.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filesel.c	2012-04-14 12:03:23 UTC (rev 45628)
+++ trunk/blender/source/blender/editors/space_file/filesel.c	2012-04-14 15:06:41 UTC (rev 45629)
@@ -123,7 +123,7 @@
 		const short is_directory= (RNA_struct_find_property(op->ptr, "directory") != NULL);
 		const short is_relative_path= (RNA_struct_find_property(op->ptr, "relative_path") != NULL);
 
-		BLI_strncpy(params->title, op->type->name, sizeof(params->title));
+		BLI_strncpy(params->title, RNA_struct_ui_name(op->type->srna), sizeof(params->title));
 
 		if (RNA_struct_find_property(op->ptr, "filemode"))
 			params->type = RNA_int_get(op->ptr, "filemode");

Modified: trunk/blender/source/blender/editors/space_node/node_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_buttons.c	2012-04-14 12:03:23 UTC (rev 45628)
+++ trunk/blender/source/blender/editors/space_node/node_buttons.c	2012-04-14 15:06:41 UTC (rev 45629)
@@ -44,6 +44,8 @@
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_node.h"
@@ -150,7 +152,7 @@
 	
 	pt= MEM_callocN(sizeof(PanelType), "spacetype node panel active node");
 	strcpy(pt->idname, "NODE_PT_item");
-	strcpy(pt->label, "Active Node");
+	strcpy(pt->label, IFACE_("Active Node"));
 	pt->draw= active_node_panel;
 	pt->poll= active_node_poll;
 	BLI_addtail(&art->paneltypes, pt);

Modified: trunk/blender/source/blender/editors/space_outliner/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/CMakeLists.txt	2012-04-14 12:03:23 UTC (rev 45628)
+++ trunk/blender/source/blender/editors/space_outliner/CMakeLists.txt	2012-04-14 15:06:41 UTC (rev 45629)
@@ -22,6 +22,7 @@
 	../include
 	../../blenkernel
 	../../blenlib
+	../../blenfont
 	../../blenloader
 	../../imbuf
 	../../makesdna
@@ -47,4 +48,8 @@
 	outliner_intern.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}" "${INC_SYS}")

Modified: trunk/blender/source/blender/editors/space_outliner/SConscript
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/SConscript	2012-04-14 12:03:23 UTC (rev 45628)
+++ trunk/blender/source/blender/editors/space_outliner/SConscript	2012-04-14 15:06:41 UTC (rev 45629)
@@ -2,9 +2,13 @@
 Import ('env')
 
 sources = env.Glob('*.c')
+defs = []
 
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenfont ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc ../../makesrna ../../blenloader'
 incs += ' #/extern/glew/include'
 
-env.BlenderLib ( 'bf_editors_space_outliner', sources, Split(incs), [], libtype=['core'], priority=[60] )
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_space_outliner', sources, Split(incs), defines=defs, libtype=['core'], priority=[60] )

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_edit.c	2012-04-14 12:03:23 UTC (rev 45628)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_edit.c	2012-04-14 15:06:41 UTC (rev 45629)
@@ -65,6 +65,7 @@
 # include <fnmatch.h>
 #endif
 
+#include "BLF_translation.h"
 
 #include "BKE_animsys.h"
 #include "BKE_context.h"
@@ -1538,7 +1539,7 @@
 		}
 		else {
 			/* Menu creation */
-			uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", ICON_NONE);
+			uiPopupMenu *pup= uiPupMenuBegin(C, IFACE_("Set Parent To"), ICON_NONE);
 			uiLayout *layout= uiPupMenuLayout(pup);
 			
 			PointerRNA ptr;
@@ -1548,7 +1549,8 @@
 			RNA_string_set(&ptr, "child", childname);
 			RNA_enum_set(&ptr, "type", PAR_OBJECT);
 			/* Cannot use uiItemEnumO()... have multiple properties to set. */
-			uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Object", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+			uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Object"),
+			            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 			
 			/* par becomes parent, make the associated menus */
 			if (par->type==OB_ARMATURE) {
@@ -1556,57 +1558,66 @@
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_ARMATURE);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Armature Deform", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Armature Deform"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_ARMATURE_NAME);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "   With Empty Groups", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("   With Empty Groups"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_ARMATURE_ENVELOPE);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "   With Envelope Weights", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("   With Envelope Weights"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_ARMATURE_AUTO);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "   With Automatic Weights", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("   With Automatic Weights"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_BONE);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Bone", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Bone"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 			}
 			else if (par->type==OB_CURVE) {
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_CURVE);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Curve Deform", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Curve Deform"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_FOLLOW);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Follow Path", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Follow Path"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_PATH_CONST);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Path Constraint", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Path Constraint"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 			}

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list