I18n: Translate labels using node UI function from node_add_menu.py
In 2a1a658492, layout functions for nodes were refactored and new
methods were introduced, but this change was not applied to the
translation extraction script.
This commit adds these method names and argument order to Python
extraction: "node_operator", "node_operator_with_outputs",
"simulation_zone", "repeat_zone", "for_each_element_zone",
"closure_zone".
Tooltips specified in a special structure are manually extracted using
`n_()`.
Actual translation is done manually in the UI methods inside NodeMenu,
in order to override the context, which by default would have been
"Operator".
Reported by Ye Gui in #43295.
Pull Request: https://projects.blender.org/blender/blender/pulls/147582
This commit is contained in:
@@ -677,6 +677,13 @@ def dump_py_messages_from_files(msgs, reports, files, settings):
|
||||
("add_repeat_zone", 1),
|
||||
("add_foreach_geometry_element_zone", 1),
|
||||
("add_closure_zone", 1),
|
||||
("node_operator", 4),
|
||||
("node_operator_with_outputs", 6),
|
||||
("simulation_zone", 2),
|
||||
("repeat_zone", 2),
|
||||
("for_each_element_zone", 2),
|
||||
("closure_zone", 2),
|
||||
|
||||
):
|
||||
func_translate_args[func_id] = {"label": (arg_pos, {})}
|
||||
# print(func_translate_args)
|
||||
|
||||
@@ -26,6 +26,7 @@ from bpy.app.translations import (
|
||||
pgettext_tip as tip_,
|
||||
pgettext_data as data_,
|
||||
pgettext_rpt as rpt_,
|
||||
pgettext_n as n_,
|
||||
)
|
||||
|
||||
|
||||
@@ -602,16 +603,16 @@ class ZoneOperator:
|
||||
|
||||
_zone_tooltips = {
|
||||
"GeometryNodeSimulationInput": (
|
||||
"Simulate the execution of nodes across a time span"
|
||||
n_("Simulate the execution of nodes across a time span")
|
||||
),
|
||||
"GeometryNodeRepeatInput": (
|
||||
"Execute nodes with a dynamic number of repetitions"
|
||||
n_("Execute nodes with a dynamic number of repetitions")
|
||||
),
|
||||
"GeometryNodeForeachGeometryElementInput": (
|
||||
"Perform operations separately for each geometry element (e.g. vertices, edges, etc.)"
|
||||
n_("Perform operations separately for each geometry element (e.g. vertices, edges, etc.)")
|
||||
),
|
||||
"NodeClosureInput": (
|
||||
"Wrap nodes inside a closure that can be executed at a different part of the node-tree"
|
||||
n_("Wrap nodes inside a closure that can be executed at a different part of the node-tree")
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ class NodeMenu(Menu):
|
||||
|
||||
@classmethod
|
||||
def simulation_zone(cls, layout, label):
|
||||
props = layout.operator(cls.zone_operator_id, text=label)
|
||||
props = layout.operator(cls.zone_operator_id, text=iface_(label), translate=False)
|
||||
props.input_node_type = "GeometryNodeSimulationInput"
|
||||
props.output_node_type = "GeometryNodeSimulationOutput"
|
||||
props.add_default_geometry_link = True
|
||||
@@ -362,7 +362,7 @@ class NodeMenu(Menu):
|
||||
|
||||
@classmethod
|
||||
def repeat_zone(cls, layout, label):
|
||||
props = layout.operator(cls.zone_operator_id, text=label)
|
||||
props = layout.operator(cls.zone_operator_id, text=iface_(label), translate=False)
|
||||
props.input_node_type = "GeometryNodeRepeatInput"
|
||||
props.output_node_type = "GeometryNodeRepeatOutput"
|
||||
props.add_default_geometry_link = True
|
||||
@@ -374,7 +374,7 @@ class NodeMenu(Menu):
|
||||
|
||||
@classmethod
|
||||
def for_each_element_zone(cls, layout, label):
|
||||
props = layout.operator(cls.zone_operator_id, text=label)
|
||||
props = layout.operator(cls.zone_operator_id, text=iface_(label), translate=False)
|
||||
props.input_node_type = "GeometryNodeForeachGeometryElementInput"
|
||||
props.output_node_type = "GeometryNodeForeachGeometryElementOutput"
|
||||
props.add_default_geometry_link = False
|
||||
@@ -386,7 +386,7 @@ class NodeMenu(Menu):
|
||||
|
||||
@classmethod
|
||||
def closure_zone(cls, layout, label):
|
||||
props = layout.operator(cls.zone_operator_id, text=label)
|
||||
props = layout.operator(cls.zone_operator_id, text=iface_(label), translate=False)
|
||||
props.input_node_type = "NodeClosureInput"
|
||||
props.output_node_type = "NodeClosureOutput"
|
||||
props.add_default_geometry_link = False
|
||||
|
||||
Reference in New Issue
Block a user