[Bf-blender-cvs] [9d732445b90] blender-v3.4-release: I18n: make a few messages translatable.

Damien Picard noreply at git.blender.org
Wed Nov 16 12:32:34 CET 2022


Commit: 9d732445b90a32c42364b80954818c16cec5eae0
Author: Damien Picard
Date:   Wed Nov 16 12:27:20 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB9d732445b90a32c42364b80954818c16cec5eae0

I18n: make a few messages translatable.

I18n: make a few messages translatable

    * Missing Paths * in the Presets menu when no preset exists yet.
    The White Noise entry in the Add Node menu is the only one lacking a "Texture" suffix, which doesn't seem justified since the node itself is already called "White Noise Texture". Rename the entry its name can be extracted and used for the node--and for consistency.
    New object material node names (Principled BSDF, Material Output) come from a preset node tree. The nodes' names need to be translated after creation.
    Extract the "Fallback Tool" pie menu title.
    Translate grease pencil options in the viewport overlay menu.

Ref T102030.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16345

===================================================================

M	release/scripts/modules/bl_i18n_utils/settings.py
M	release/scripts/startup/bl_operators/wm.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/space_node/node_edit.cc
M	source/blender/nodes/NOD_static_types.h

===================================================================

diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index efb16cf18c0..fd596036157 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -549,6 +549,7 @@ CUSTOM_PY_UI_FILES = [
     os.path.join("scripts", "startup", "bl_operators"),
     os.path.join("scripts", "modules", "rna_prop_ui.py"),
     os.path.join("scripts", "modules", "rna_keymap_ui.py"),
+    os.path.join("scripts", "modules", "bpy_types.py"),
     os.path.join("scripts", "presets", "keyconfig"),
 ]
 
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 4bb3ab16a70..0483a20cb29 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -2289,7 +2289,7 @@ class WM_OT_toolbar_fallback_pie(Operator):
             ToolSelectPanelHelper.draw_fallback_tool_items_for_pie_menu(self.layout, context)
 
         wm = context.window_manager
-        wm.popup_menu_pie(draw_func=draw_cb, title="Fallback Tool", event=event)
+        wm.popup_menu_pie(draw_func=draw_cb, title=iface_("Fallback Tool"), event=event)
         return {'FINISHED'}
 
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 32c4fe722b0..b4ed83c97af 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -19,6 +19,7 @@ from bl_ui.space_toolsystem_common import (
     ToolActivePanelHelper,
 )
 from bpy.app.translations import (
+    pgettext_iface as iface_,
     pgettext_tip as tip_,
     contexts as i18n_contexts,
 )
@@ -703,7 +704,7 @@ class VIEW3D_HT_header(Header):
         sub.ui_units_x = 5.5
         sub.operator_menu_enum(
             "object.mode_set", "mode",
-            text=bpy.app.translations.pgettext_iface(act_mode_item.name, act_mode_i18n_context),
+            text=iface_(act_mode_item.name, act_mode_i18n_context),
             icon=act_mode_item.icon,
         )
         del act_mode_item
@@ -7081,13 +7082,13 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
     def draw_header(self, context):
         layout = self.layout
         layout.label(text={
-            'PAINT_GPENCIL': "Draw Grease Pencil",
-            'EDIT_GPENCIL': "Edit Grease Pencil",
-            'SCULPT_GPENCIL': "Sculpt Grease Pencil",
-            'WEIGHT_GPENCIL': "Weight Grease Pencil",
-            'VERTEX_GPENCIL': "Vertex Grease Pencil",
-            'OBJECT': "Grease Pencil",
-        }[context.mode])
+            'PAINT_GPENCIL': iface_("Draw Grease Pencil"),
+            'EDIT_GPENCIL': iface_("Edit Grease Pencil"),
+            'SCULPT_GPENCIL': iface_("Sculpt Grease Pencil"),
+            'WEIGHT_GPENCIL': iface_("Weight Grease Pencil"),
+            'VERTEX_GPENCIL': iface_("Vertex Grease Pencil"),
+            'OBJECT': iface_("Grease Pencil"),
+        }[context.mode], translate=False)
 
     def draw(self, context):
         layout = self.layout
diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc
index c6aeda8c9ab..44eb57e59a5 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -503,6 +503,11 @@ void ED_node_shader_default(const bContext *C, ID *id)
 
     ma->nodetree = ntreeCopyTree(bmain, ma_default->nodetree);
     ma->nodetree->owner_id = &ma->id;
+    LISTBASE_FOREACH (bNode *, node_iter, &ma->nodetree->nodes) {
+      BLI_strncpy(node_iter->name, DATA_(node_iter->name), NODE_MAXSTR);
+      nodeUniqueName(ma->nodetree, node_iter);
+    }
+
     BKE_ntree_update_main_tree(bmain, ma->nodetree, nullptr);
   }
   else if (ELEM(GS(id->name), ID_WO, ID_LA)) {
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index 9671f8148ec..2fcdb215e42 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -117,7 +117,7 @@ DefNode(ShaderNode,     SH_NODE_BEVEL,              def_sh_bevel,           "BEV
 DefNode(ShaderNode,     SH_NODE_DISPLACEMENT,       def_sh_displacement,    "DISPLACEMENT",       Displacement,     "Displacement",      "Displace the surface along the surface normal")
 DefNode(ShaderNode,     SH_NODE_VECTOR_DISPLACEMENT,def_sh_vector_displacement,"VECTOR_DISPLACEMENT",VectorDisplacement,"Vector Displacement","Displace the surface along an arbitrary direction")
 DefNode(ShaderNode,     SH_NODE_TEX_IES,            def_sh_tex_ies,         "TEX_IES",            TexIES,           "IES Texture",       "Used to match real world lights with IES files, which store the directional intensity distribution of light sources")
-DefNode(ShaderNode,     SH_NODE_TEX_WHITE_NOISE,    def_sh_tex_white_noise, "TEX_WHITE_NOISE",    TexWhiteNoise,    "White Noise",       "Return a random value or color based on an input seed")
+DefNode(ShaderNode,     SH_NODE_TEX_WHITE_NOISE,    def_sh_tex_white_noise, "TEX_WHITE_NOISE",    TexWhiteNoise,    "White Noise Texture","Return a random value or color based on an input seed")
 DefNode(ShaderNode,     SH_NODE_OUTPUT_AOV,         def_sh_output_aov,      "OUTPUT_AOV",         OutputAOV,        "AOV Output",        "Arbitrary Output Variables.\nProvide custom render passes for arbitrary shader node outputs")
 DefNode(ShaderNode,     SH_NODE_CURVE_FLOAT,        def_float_curve,        "CURVE_FLOAT",        FloatCurve,       "Float Curve",       "Map an input float to a curve and outputs a float value")
 DefNode(ShaderNode,     SH_NODE_COMBINE_COLOR,      def_sh_combsep_color,   "COMBINE_COLOR",      CombineColor,     "Combine Color",     "Create a color from individual components using multiple models")



More information about the Bf-blender-cvs mailing list