I18n: extract and disambiguate a few messages

Extract:
- Compositor error messages.
- `bUnitDef`s were broken after cleanup commit 2b77cd726d. Since each
  unit's "display name" is now preceded by a consistent "name_display"
  comment, the regex which extracts the unit is greatly simplified.
  It now relies on the presence of the comment instead of the struct
  order.
- "Preset" menu and "Apply Preset" button from the curveprofile
  template.
- Operator labels from the catalog context menu.

Disambiguate:
- "Bake Data": can mean "Which data to bake" (verb), or "The data that
  were baked" (noun).
- "Cache" in the Simulation Nodes panel is a verb, not a noun.
- "Mix" in the snapping menu is a noun, not a verb.
- "Top" and "Bottom" can mean the upper part of an object or the
  highest point or element of something like a menu or list.

Pull Request: https://projects.blender.org/blender/blender/pulls/115963
This commit is contained in:
Damien Picard
2023-12-19 18:41:09 +01:00
committed by Bastien Montagne
parent 4ef5d9f60f
commit faefaa4447
11 changed files with 49 additions and 26 deletions

View File

@@ -252,12 +252,18 @@ PYGETTEXT_KEYWORDS = (() +
for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf",
"CTX_wm_operator_poll_msg_set", "WM_report", "WM_reportf")) +
# bmesh operator errors
tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*\)").format(it)
for it in ("BMO_error_raise",)) +
# Modifier errors
tuple(("{}\\((?:[^\"',]+,){{2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
for it in ("BKE_modifier_set_error",)) +
# Compositor error messages
tuple((r"\.{}\(\s*" + _msg_re + r"\s*\)").format(it)
for it in ("set_info_message",)) +
# 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)
@@ -297,13 +303,8 @@ PYGETTEXT_KEYWORDS = (() +
# Geometry Nodes field inputs
((r"FieldInput\(CPPType::get<.*?>\(\),\s*" + _msg_re + r"\s*\)"),) +
# 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
# becomes extremely slow to process some (unrelated) source files.
((r"\{(?:(?:\s*\"[^\",]+\"\s*,)|(?:\s*\"\\\"\",)|(?:\s*nullptr\s*,)){4}\s*" +
_msg_re + r"\s*,(?:(?:\s*\"[^\"',]+\"\s*,)|(?:\s*nullptr\s*,))(?:[^,]+,){2}"
+ "(?:\|?\s*B_UNIT_DEF_[_A-Z]+\s*)+\}"),) +
# bUnitDef unit names
((r"/\*name_display\*/\s*" + _msg_re + r"\s*,"),) +
tuple((r"{}\(\s*" + _msg_re + r"\s*,\s*(?:" +
r"\s*,\s*)?(?:".join(_ctxt_re_gen(i) for i in range(PYGETTEXT_MAX_MULTI_CTXT)) + r")?\s*\)").format(it)