From 92c026c39ba9cfdc92f5a463a6aca963d20d7a22 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Mon, 24 Jun 2024 18:45:07 +0200 Subject: [PATCH] I18n: Fix multi-context message extraction regex The BLT_I18N_MSGID_MULTI_CTXT() macro allows extracting a single message into up to 16 different contexts. The regex to do that was slightly wrong because it did not account for the macro potentially ending with a ",". The contexts for "New" were also sorted. Pull Request: https://projects.blender.org/blender/blender/pulls/123793 --- scripts/modules/bl_i18n_utils/settings.py | 2 +- .../editors/interface/templates/interface_templates.cc | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/modules/bl_i18n_utils/settings.py b/scripts/modules/bl_i18n_utils/settings.py index 23e278a9aec..eb668688ceb 100644 --- a/scripts/modules/bl_i18n_utils/settings.py +++ b/scripts/modules/bl_i18n_utils/settings.py @@ -312,7 +312,7 @@ PYGETTEXT_KEYWORDS = (() + ((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) + r"\s*,\s*)?(?:".join(_ctxt_re_gen(i) for i in range(PYGETTEXT_MAX_MULTI_CTXT)) + r")?\s*,?\s*\)").format(it) for it in ("BLT_I18N_MSGID_MULTI_CTXT",)) ) diff --git a/source/blender/editors/interface/templates/interface_templates.cc b/source/blender/editors/interface/templates/interface_templates.cc index ce47afc7e57..5316ec26c35 100644 --- a/source/blender/editors/interface/templates/interface_templates.cc +++ b/source/blender/editors/interface/templates/interface_templates.cc @@ -1230,13 +1230,15 @@ static uiBut *template_id_def_new_but(uiBlock *block, BLT_I18NCONTEXT_ID_LATTICE, BLT_I18NCONTEXT_ID_LIGHT, BLT_I18NCONTEXT_ID_LIGHTPROBE, + BLT_I18NCONTEXT_ID_MASK, BLT_I18NCONTEXT_ID_MATERIAL, - BLT_I18NCONTEXT_ID_MASK, ); + BLT_I18NCONTEXT_ID_MESH, ); BLT_I18N_MSGID_MULTI_CTXT("New", - BLT_I18NCONTEXT_ID_MESH, BLT_I18NCONTEXT_ID_METABALL, BLT_I18NCONTEXT_ID_NODETREE, BLT_I18NCONTEXT_ID_OBJECT, + BLT_I18NCONTEXT_ID_PAINTCURVE, + BLT_I18NCONTEXT_ID_PALETTE, BLT_I18NCONTEXT_ID_PARTICLESETTINGS, BLT_I18NCONTEXT_ID_POINTCLOUD, BLT_I18NCONTEXT_ID_SCENE, @@ -1248,7 +1250,6 @@ static uiBut *template_id_def_new_but(uiBlock *block, BLT_I18NCONTEXT_ID_VOLUME, BLT_I18NCONTEXT_ID_WORKSPACE, BLT_I18NCONTEXT_ID_WORLD, ); - BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_ID_PAINTCURVE, BLT_I18NCONTEXT_ID_PALETTE, ); /* NOTE: BLT_I18N_MSGID_MULTI_CTXT takes a maximum number of parameters, * check the definition to see if a new call must be added when the limit * is exceeded. */