diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-03-26 18:33:53 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-03-26 18:33:53 +0400 |
commit | b4bd43e02283d5c2df07b49441a9de24f327736f (patch) | |
tree | b5acf9ff066adc73cc2d2631b6e6b6e76cdc6e60 /source/blender/editors | |
parent | 0c07c33fec4ef04f2931863f40f4447aaf810064 (diff) |
I18n: various "new data translation" fixes...
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 10 | ||||
-rw-r--r-- | source/blender/editors/render/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/editors/render/SConscript | 7 | ||||
-rw-r--r-- | source/blender/editors/render/render_shading.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_add.c | 11 |
6 files changed, 43 insertions, 15 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index e4c7a1edbcb..ad32c5fcccf 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -43,6 +43,8 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_anim_types.h" #include "DNA_curve_types.h" #include "DNA_object_types.h" @@ -229,7 +231,7 @@ static int gp_data_add_exec(bContext *C, wmOperator *op) bGPdata *gpd = (*gpd_ptr); id_us_min(&gpd->id); - *gpd_ptr = gpencil_data_addnew("GPencil"); + *gpd_ptr = gpencil_data_addnew(DATA_("GPencil")); } /* notifiers */ @@ -312,10 +314,10 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } if (*gpd_ptr == NULL) - *gpd_ptr = gpencil_data_addnew("GPencil"); - + *gpd_ptr = gpencil_data_addnew(DATA_("GPencil")); + /* add new layer now */ - gpencil_layer_addnew(*gpd_ptr, "GP_Layer", 1); + gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), 1); /* notifiers */ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index 3c5fd0b4ef7..c0b9088017e 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -68,4 +68,8 @@ if(WITH_HEADLESS) add_definitions(-DWITH_HEADLESS) endif() +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + blender_add_lib(bf_editor_render "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript index 73bc711edd9..9350caf5a12 100644 --- a/source/blender/editors/render/SConscript +++ b/source/blender/editors/render/SConscript @@ -35,6 +35,8 @@ incs += ' ../../gpu' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' incs += ' ../../blenloader ../../bmesh ../../blenfont' +defs = [] + if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' @@ -54,4 +56,7 @@ if env['OURPLATFORM'] == 'darwin': if env['WITH_BF_OPENMP']: env.Append(CFLAGS=['-DPARALLEL=1']) -env.BlenderLib ( 'bf_editors_render', sources, Split(incs), [], libtype=['core'], priority=[45]) +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') + +env.BlenderLib('bf_editors_render', sources, Split(incs), defs, libtype=['core'], priority=[45]) diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index dc26bde6861..979ccf3cf02 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -428,10 +428,12 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) PropertyRNA *prop; /* add or copy texture */ - if (tex) + if (tex) { tex = BKE_texture_copy(tex); - else + } + else { tex = add_texture(bmain, DATA_("Texture")); + } /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); @@ -480,7 +482,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) wo = BKE_world_copy(wo); } else { - wo = add_world(bmain, "World"); + wo = add_world(bmain, DATA_("World")); if (BKE_scene_use_new_shading_nodes(scene)) { ED_node_shader_default(C, &wo->id); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 7e0767bfcfb..4a78c54e9c0 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1707,6 +1707,7 @@ void IMAGE_OT_reload(wmOperatorType *ot) } /********************** new image operator *********************/ +#define IMA_DEF_NAME N_("Untitled") static int image_new_exec(bContext *C, wmOperator *op) { @@ -1717,7 +1718,8 @@ static int image_new_exec(bContext *C, wmOperator *op) Main *bmain; PointerRNA ptr, idptr; PropertyRNA *prop; - char name[MAX_ID_NAME - 2]; + char _name[MAX_ID_NAME - 2]; + char *name = _name; float color[4]; int width, height, floatbuf, gen_type, alpha; @@ -1727,7 +1729,12 @@ static int image_new_exec(bContext *C, wmOperator *op) obedit = CTX_data_edit_object(C); bmain = CTX_data_main(C); - RNA_string_get(op->ptr, "name", name); + prop = RNA_struct_find_property(op->ptr, "name"); + RNA_property_string_get(op->ptr, prop, name); + if (!RNA_property_is_set(op->ptr, prop)) { + /* Default value, we can translate! */ + name = (char *)DATA_(name); + } width = RNA_int_get(op->ptr, "width"); height = RNA_int_get(op->ptr, "height"); floatbuf = RNA_boolean_get(op->ptr, "float"); @@ -1775,8 +1782,9 @@ static int image_new_exec(bContext *C, wmOperator *op) /* XXX Note: the WM_operator_props_dialog_popup() doesn't work for uiIDContextProperty(), image is not being that way */ static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { + /* Better for user feedback. */ + RNA_string_set(op->ptr, "name", DATA_(IMA_DEF_NAME)); return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, 5 * UI_UNIT_Y); - } void IMAGE_OT_new(wmOperatorType *ot) @@ -1797,7 +1805,7 @@ void IMAGE_OT_new(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_string(ot->srna, "name", "untitled", MAX_ID_NAME - 2, "Name", "Image datablock name"); + RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image datablock name"); RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width", 1, 16384); RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height", 1, 16384); prop = RNA_def_float_color(ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color", 0.0f, 1.0f); @@ -1809,6 +1817,8 @@ void IMAGE_OT_new(wmOperatorType *ot) RNA_def_boolean(ot->srna, "float", 0, "32 bit Float", "Create image with 32 bit floating point bit depth"); } +#undef IMA_DEF_NAME + /********************* invert operators *********************/ static int image_invert_poll(bContext *C) diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index fb9e1221c38..0201071ada4 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -83,7 +83,7 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx /* generics */ node->locx = locx; - node->locy = locy + 60.0f; // arbitrary.. so its visible, (0,0) is top of node + node->locy = locy + 60.0f; /* arbitrary... so its visible, (0,0) is top of node */ nodeSetSelected(node, TRUE); /* node location is mapped */ @@ -436,7 +436,8 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) PointerRNA ptr, idptr; PropertyRNA *prop; const char *idname; - char treename[MAX_ID_NAME - 2] = "NodeTree"; + char _treename[MAX_ID_NAME - 2]; + char *treename = _treename; if (RNA_struct_property_is_set(op->ptr, "type")) { prop = RNA_struct_find_property(op->ptr, "type"); @@ -445,8 +446,12 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) else if (snode) idname = snode->tree_idname; - if (RNA_struct_property_is_set(op->ptr, "name")) + if (RNA_struct_property_is_set(op->ptr, "name")) { RNA_string_get(op->ptr, "name", treename); + } + else { + treename = (char *)DATA_("NodeTree"); + } if (!ntreeTypeFind(idname)) { BKE_reportf(op->reports, RPT_ERROR, "Node tree type %s undefined", idname); |