[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44942] trunk/blender/source/blender: Big step forward nodes UI translation:
Bastien Montagne
montagne29 at wanadoo.fr
Sat Mar 17 15:42:48 CET 2012
Revision: 44942
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44942
Author: mont29
Date: 2012-03-17 14:42:44 +0000 (Sat, 17 Mar 2012)
Log Message:
-----------
Big step forward nodes UI translation:
*Add menu is now translated.
*Nodes' title is now translated.
*Nodes' sockets' labels are now translated.
However, about the last point, and unless I?\226?\128?\153m mistaking, we?\226?\128?\153ll have to add the "i18n tag" N_() to all sockets' names, in the input/ouput templates declaration, in all nodes' files, as those sockets are collections created at runtime, I think po-generating script has no way to access that from bpy.types... Quite a piece of (borring) work. :/
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/node.c
trunk/blender/source/blender/editors/space_node/node_draw.c
trunk/blender/source/blender/editors/space_node/node_header.c
trunk/blender/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
trunk/blender/source/blender/nodes/intern/node_common.c
trunk/blender/source/blender/nodes/intern/node_util.c
Modified: trunk/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/node.c 2012-03-17 14:27:46 UTC (rev 44941)
+++ trunk/blender/source/blender/blenkernel/intern/node.c 2012-03-17 14:42:44 UTC (rev 44942)
@@ -55,6 +55,8 @@
#include "BLI_path_util.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_fcurve.h"
@@ -66,8 +68,6 @@
#include "BKE_utildefines.h"
#include "BKE_utildefines.h"
-#include "BLI_listbase.h"
-
#include "RNA_access.h"
#include "NOD_socket.h"
@@ -1658,7 +1658,7 @@
else if (node->typeinfo->labelfunc)
return node->typeinfo->labelfunc(node);
else
- return node->typeinfo->name;
+ return IFACE_(node->typeinfo->name);
}
struct bNodeTree *nodeGroupEditGet(struct bNode *node)
Modified: trunk/blender/source/blender/editors/space_node/node_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_draw.c 2012-03-17 14:27:46 UTC (rev 44941)
+++ trunk/blender/source/blender/editors/space_node/node_draw.c 2012-03-17 14:42:44 UTC (rev 44942)
@@ -49,6 +49,8 @@
#include "BLI_threads.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
@@ -717,14 +719,12 @@
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE);
if (stype->buttonfunc)
- stype->buttonfunc(C, node->block, ntree, node, sock, sock->name, sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY);
+ stype->buttonfunc(C, node->block, ntree, node, sock, IFACE_(sock->name), sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY);
}
/* socket outputs */
for(sock= node->outputs.first; sock; sock= sock->next) {
PointerRNA sockptr;
- float slen;
- int ofs;
RNA_pointer_create((ID*)ntree, &RNA_NodeSocket, sock, &sockptr);
@@ -733,15 +733,19 @@
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE);
- ofs= 0;
- UI_ThemeColor(TH_TEXT);
- slen= snode->aspect*UI_GetStringWidth(sock->name);
- while(slen > node->width) {
- ofs++;
- slen= snode->aspect*UI_GetStringWidth(sock->name+ofs);
+ {
+ const char *name = IFACE_(sock->name);
+ float slen;
+ int ofs = 0;
+ UI_ThemeColor(TH_TEXT);
+ slen= snode->aspect*UI_GetStringWidth(name);
+ while(slen > node->width) {
+ ofs++;
+ slen= snode->aspect*UI_GetStringWidth(name+ofs);
+ }
+ uiDefBut(node->block, LABEL, 0, name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f),
+ (short)(node->width-NODE_DY), NODE_DY, NULL, 0, 0, 0, 0, "");
}
- uiDefBut(node->block, LABEL, 0, sock->name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f),
- (short)(node->width-NODE_DY), NODE_DY, NULL, 0, 0, 0, 0, "");
}
/* preview */
Modified: trunk/blender/source/blender/editors/space_node/node_header.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_header.c 2012-03-17 14:27:46 UTC (rev 44941)
+++ trunk/blender/source/blender/editors/space_node/node_header.c 2012-03-17 14:42:44 UTC (rev 44942)
@@ -214,11 +214,11 @@
/* XXX hack: negative numbers used for empty group types */
if (node_tree_has_type(ntree->type, NODE_GROUP))
- uiItemV(layout, "New Group", 0, -NODE_GROUP);
+ uiItemV(layout, IFACE_("New Group"), 0, -NODE_GROUP);
if (node_tree_has_type(ntree->type, NODE_FORLOOP))
- uiItemV(layout, "New For Loop", 0, -NODE_FORLOOP);
+ uiItemV(layout, IFACE_("New For Loop"), 0, -NODE_FORLOOP);
if (node_tree_has_type(ntree->type, NODE_WHILELOOP))
- uiItemV(layout, "New While Loop", 0, -NODE_WHILELOOP);
+ uiItemV(layout, IFACE_("New While Loop"), 0, -NODE_WHILELOOP);
uiItemS(layout);
for(ngroup=bmain->nodetree.first, event=0; ngroup; ngroup= ngroup->id.next, ++event) {
@@ -239,7 +239,7 @@
for (ntype=ntreeGetType(ntree->type)->node_types.first; ntype; ntype=ntype->next) {
if (ntype->nclass==nodeclass && ntype->name)
if (!compatibility || (ntype->compatibility & compatibility))
- uiItemV(layout, ntype->name, 0, ntype->type);
+ uiItemV(layout, IFACE_(ntype->name), 0, ntype->type);
}
}
}
@@ -247,7 +247,7 @@
static void node_menu_add_foreach_cb(void *calldata, int nclass, const char *name)
{
uiLayout *layout= calldata;
- uiItemMenuF(layout, name, 0, node_add_menu, SET_INT_IN_POINTER(nclass));
+ uiItemMenuF(layout, IFACE_(name), 0, node_add_menu, SET_INT_IN_POINTER(nclass));
}
static void node_menu_add(const bContext *C, Menu *menu)
Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c 2012-03-17 14:27:46 UTC (rev 44941)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c 2012-03-17 14:42:44 UTC (rev 44942)
@@ -30,7 +30,9 @@
* \ingroup cmpnodes
*/
+#include "BLF_translation.h"
+
#include "node_composite_util.h"
/* **************** Translate ******************** */
@@ -105,9 +107,9 @@
static const char *label(bNode *node)
{
if(node->custom1==0)
- return "Undistortion";
+ return IFACE_("Undistortion");
else
- return "Distortion";
+ return IFACE_("Distortion");
}
static void storage_free(bNode *node)
Modified: trunk/blender/source/blender/nodes/intern/node_common.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/node_common.c 2012-03-17 14:27:46 UTC (rev 44941)
+++ trunk/blender/source/blender/nodes/intern/node_common.c 2012-03-17 14:42:44 UTC (rev 44942)
@@ -40,6 +40,8 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_global.h"
@@ -487,7 +489,7 @@
/* groups display their internal tree name as label */
const char *node_group_label(bNode *node)
{
- return (node->id)? node->id->name+2: "Missing Datablock";
+ return (node->id)? node->id->name+2: IFACE_("Missing Datablock");
}
int node_group_valid(bNodeTree *ntree, bNodeTemplate *ntemp)
Modified: trunk/blender/source/blender/nodes/intern/node_util.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/node_util.c 2012-03-17 14:27:46 UTC (rev 44941)
+++ trunk/blender/source/blender/nodes/intern/node_util.c 2012-03-17 14:42:44 UTC (rev 44942)
@@ -36,6 +36,8 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_colortools.h"
#include "BKE_node.h"
@@ -74,28 +76,28 @@
{
const char *name;
RNA_enum_name(ramp_blend_items, node->custom1, &name);
- return name;
+ return IFACE_(name);
}
const char *node_math_label(bNode *node)
{
const char *name;
RNA_enum_name(node_math_items, node->custom1, &name);
- return name;
+ return IFACE_(name);
}
const char *node_vect_math_label(bNode *node)
{
const char *name;
RNA_enum_name(node_vec_math_items, node->custom1, &name);
- return name;
+ return IFACE_(name);
}
const char *node_filter_label(bNode *node)
{
const char *name;
RNA_enum_name(node_filter_items, node->custom1, &name);
- return name;
+ return IFACE_(name);
}
ListBase node_internal_connect_default(bNodeTree *ntree, bNode *node)
More information about the Bf-blender-cvs
mailing list