I18n: Improve message extraction for node socket declaration

Node sockets could already be declared using:

```cpp
add_input<decl::<SOCKET TYPE>>("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.
This commit is contained in:
Damien Picard
2025-09-23 18:31:24 +02:00
committed by Bastien Montagne
parent fb2f5b3a64
commit 4e034b5ecb

View File

@@ -282,12 +282,12 @@ PYGETTEXT_KEYWORDS = (() +
for it in ("modifier_subpanel_register", "gpencil_modifier_subpanel_register")) +
# Node socket declarations: context-less names.
tuple((r"\.{}<decl::.*?>\(\s*" + _msg_re + r"(?:,[^),]+)*\s*\)"
tuple((r"\.{}(?:<decl::.*?>\(|[^,]+,)\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"\.{}<decl::.*?>\(\s*" + _msg_re + r"[^;]*\.translation_context\(\s*" + _ctxt_re + r"\s*\)").format(it)
tuple((r"\.{}(?:<decl::.*?>\(|[^,]+,)\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