I18n: Extract many messages from ED_push_undo

This function is used to add undo steps. It includes a message, for
use in the Undo History menu. This label uses the "Operator" context
for translation.

This commit adds automatic extraction of two functions `ED_undo_push`
and `ED_undo_grouped_push`, as well as manual extraction for many
strings not declared in the function calls.

In order to extract those messages using the proper context, the
extraction logic had to be changed so that a custom context could be
specified. The regexes can now be either a pattern, or
a (ctxt_override, pattern) tuple.

Pull Request: https://projects.blender.org/blender/blender/pulls/147581
This commit is contained in:
Damien Picard
2025-10-07 19:58:24 +02:00
committed by Gitea
parent d57d76f23d
commit 84fc90bb43
5 changed files with 38 additions and 26 deletions

View File

@@ -269,6 +269,11 @@ PYGETTEXT_KEYWORDS = (() +
"CTX_wm_operator_poll_msg_set", "WM_global_report", "WM_global_reportf",
"UI_but_disable")) +
# ED_undo_push() is used in Undo History menu and has the "Operator" context, same as operators.
tuple(PyGettextKeyword(("{}\\((?:[^\"',]+,)\\s*" + _msg_re + r"\s*(?:\))").format(it),
context_override='BLT_I18NCONTEXT_OPERATOR_DEFAULT')
for it in ("ED_undo_push", "ED_undo_grouped_push")) +
# bmesh operator errors
tuple(PyGettextKeyword(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*\)").format(it))
for it in ("BMO_error_raise",)) +