Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-03-17 18:42:44 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-03-17 18:42:44 +0400
commit7bc693d1075a72b2f6c7abb1239432b4c442a92f (patch)
tree99af4b52dc6fe28aa719917b0ec0829428f39506 /source/blender/editors
parent1f6ae5e4fbc4a67afd9655d55f9930c196c9e754 (diff)
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’m mistaking, we’ll 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. :/
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_node/node_draw.c26
-rw-r--r--source/blender/editors/space_node/node_header.c10
2 files changed, 20 insertions, 16 deletions
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index a2775832c1d..46850d4ff60 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -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 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
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 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
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 */
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index df83afc143e..f450356b288 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -214,11 +214,11 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
/* 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 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
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_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
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)