From 4e034b5ecb22c96cdb7bfc0885669fe355377be9 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Tue, 23 Sep 2025 18:31:24 +0200 Subject: [PATCH] I18n: Improve message extraction for node socket declaration Node sockets could already be declared using: ```cpp add_input>("NAME") ``` They can now additionally be declared with: ```cpp add_input(socket_type, "NAME") ``` This commit adds the later form to the message extraction regex. Since they are mutually exclusive, they are now in a non-capturing group with an | operator. Reported by Ye Gui in #43295. --- scripts/modules/bl_i18n_utils/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/modules/bl_i18n_utils/settings.py b/scripts/modules/bl_i18n_utils/settings.py index 73acc6cf0d3..940b6f01be1 100644 --- a/scripts/modules/bl_i18n_utils/settings.py +++ b/scripts/modules/bl_i18n_utils/settings.py @@ -282,12 +282,12 @@ PYGETTEXT_KEYWORDS = (() + for it in ("modifier_subpanel_register", "gpencil_modifier_subpanel_register")) + # Node socket declarations: context-less names. - tuple((r"\.{}\(\s*" + _msg_re + r"(?:,[^),]+)*\s*\)" + tuple((r"\.{}(?:\(|[^,]+,)\s*" + _msg_re + r"(?:,[^),]+)*\s*\)" r"(?![^;]*\.translation_context\()").format(it) for it in ("add_input", "add_output")) + # Node socket declarations: names with contexts - tuple((r"\.{}\(\s*" + _msg_re + r"[^;]*\.translation_context\(\s*" + _ctxt_re + r"\s*\)").format(it) + tuple((r"\.{}(?:\(|[^,]+,)\s*" + _msg_re + r"[^;]*\.translation_context\(\s*" + _ctxt_re + r"\s*\)").format(it) for it in ("add_input", "add_output")) + # Node socket declarations: description and error messages