From 4ff0aacffaf56914a6e075b27a49016e485a2837 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Tue, 18 Apr 2023 01:13:17 +0200 Subject: [PATCH] I18n: translate node group socket type and subtype Node group sockets have user-exposed data types, and sometimes subtypes for some data types (e.g. Percentage or Angle for floats). The UI to select these types and subtypes use an operator menu with a text depending on the current type or subtype. This button needs to be manually translated since its label is manually defined. Additionally, some subtypes need to be extracted from the Property class's RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ITEMS, so this commit also removes Property from the extraction blacklist in bl_extract_messages.py. This has the side effect that it introduces a few dozens translations, which are probably not used anywhere. --- scripts/modules/bl_i18n_utils/bl_extract_messages.py | 2 +- scripts/startup/bl_ui/space_node.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/scripts/modules/bl_i18n_utils/bl_extract_messages.py index a8db5508880..ea4d178cf7c 100644 --- a/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -204,7 +204,7 @@ def dump_rna_messages(msgs, reports, settings, verbose=False): def class_blacklist(): blacklist_rna_class = {getattr(bpy.types, cls_id) for cls_id in ( # core classes - "Context", "Event", "Function", "UILayout", "UnknownType", "Property", "Struct", + "Context", "Event", "Function", "UILayout", "UnknownType", "Struct", # registerable classes "Panel", "Menu", "Header", "RenderEngine", "Operator", "OperatorMacro", "Macro", "KeyingSetInfo", ) diff --git a/scripts/startup/bl_ui/space_node.py b/scripts/startup/bl_ui/space_node.py index 4b40d203c6d..9174de9880c 100644 --- a/scripts/startup/bl_ui/space_node.py +++ b/scripts/startup/bl_ui/space_node.py @@ -885,7 +885,8 @@ class NodeTreeInterfacePanel(Panel): props = property_row.operator_menu_enum( "node.tree_socket_change_type", "socket_type", - text=active_socket.bl_label if active_socket.bl_label else active_socket.bl_idname, + text=(iface_(active_socket.bl_label) if active_socket.bl_label + else iface_(active_socket.bl_idname)), ) props.in_out = in_out @@ -903,10 +904,8 @@ class NodeTreeInterfacePanel(Panel): props = property_row.operator_menu_enum( "node.tree_socket_change_subtype", "socket_subtype", - text=( - active_socket.bl_subtype_label if active_socket.bl_subtype_label else - active_socket.bl_idname - ), + text=(iface_(active_socket.bl_subtype_label) if active_socket.bl_subtype_label + else iface_(active_socket.bl_idname)), ) layout.use_property_split = True -- 2.30.2