Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-07-15 12:41:13 +0300
committerBastien Montagne <bastien@blender.org>2022-07-15 12:42:58 +0300
commite69c4482f16d51e5fda4da70abb94a23f8c5b3d9 (patch)
tree7b5c1e16125aa3cfaebf694edf5d752af01077bf /release
parent8e1323f6330937a964c3776431bab02c2cfb6e2f (diff)
I18n: Add suport for labels from modifiers' subpanels.
Was a bit oif a struggle since those functions take a first string which is not our label, but should work fine now. Reported/detected as part of D15418.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bl_i18n_utils/bl_extract_messages.py23
-rw-r--r--release/scripts/modules/bl_i18n_utils/settings.py5
2 files changed, 17 insertions, 11 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index 319fd3396a0..3edb5b445fe 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -803,20 +803,21 @@ def dump_src_messages(msgs, reports, settings):
line += data[pos:m.start()].count('\n')
msgsrc = rel_path + ":" + str(line)
_msgid = d.get("msg_raw")
- # First, try the "multi-contexts" stuff!
- _msgctxts = tuple(d.get("ctxt_raw{}".format(i)) for i in range(settings.PYGETTEXT_MAX_MULTI_CTXT))
- if _msgctxts[0]:
- for _msgctxt in _msgctxts:
- if not _msgctxt:
- break
+ if _msgid not in {'""', "''"}:
+ # First, try the "multi-contexts" stuff!
+ _msgctxts = tuple(d.get("ctxt_raw{}".format(i)) for i in range(settings.PYGETTEXT_MAX_MULTI_CTXT))
+ if _msgctxts[0]:
+ for _msgctxt in _msgctxts:
+ if not _msgctxt:
+ break
+ msgctxt, msgid = process_entry(_msgctxt, _msgid)
+ process_msg(msgs, msgctxt, msgid, msgsrc, reports, check_ctxt_src, settings)
+ reports["src_messages"].append((msgctxt, msgid, msgsrc))
+ else:
+ _msgctxt = d.get("ctxt_raw")
msgctxt, msgid = process_entry(_msgctxt, _msgid)
process_msg(msgs, msgctxt, msgid, msgsrc, reports, check_ctxt_src, settings)
reports["src_messages"].append((msgctxt, msgid, msgsrc))
- else:
- _msgctxt = d.get("ctxt_raw")
- msgctxt, msgid = process_entry(_msgctxt, _msgid)
- process_msg(msgs, msgctxt, msgid, msgsrc, reports, check_ctxt_src, settings)
- reports["src_messages"].append((msgctxt, msgid, msgsrc))
pos = m.end()
line += data[m.start():pos].count('\n')
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index 9b38c512d31..3b69f8a6bf7 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -251,6 +251,11 @@ PYGETTEXT_KEYWORDS = (() +
tuple(("{}\\((?:[^\"',]+,){{2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
for it in ("BKE_modifier_set_error",)) +
+ # This one is a tad more risky, but in practice would not expect a name/uid string parameter
+ # (the second one in those functions) to ever have a comma in it, so think this is fine.
+ tuple(("{}\\((?:[^,]+,){{2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
+ for it in ("modifier_subpanel_register", "gpencil_modifier_subpanel_register")) +
+
# bUnitDef unit names.
# NOTE: regex is a bit more complex than it would need too. Since the actual
# identifier (`B_UNIT_DEF_`) is at the end, if it's simpler/too general it