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 <montagne29@wanadoo.fr>2012-11-23 19:35:16 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-11-23 19:35:16 +0400
commitbb7fdc7935b8e909dfa10ec1dde654c6ce2f18a1 (patch)
tree0f8fb9cd8dc8b857733201fd32b3b80e29b69a7a /release/scripts/modules/bl_i18n_utils/settings.py
parent00b1d50532f4f1be1fcb310cefbbe8b285fd17ee (diff)
Handle of new BLF_I18N_MSGID_MULTI_CTXT macro, which allows to define a same msgid in up to 16 different contexts at once.
Diffstat (limited to 'release/scripts/modules/bl_i18n_utils/settings.py')
-rw-r--r--release/scripts/modules/bl_i18n_utils/settings.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index f61d14eda20..c7414e84046 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -114,6 +114,9 @@ DOMAIN = "blender"
# File type (ext) to parse.
PYGETTEXT_ALLOWED_EXTS = {".c", ".cpp", ".cxx", ".hpp", ".hxx", ".h"}
+# Max number of contexts into a BLF_I18N_MSGID_MULTI_CTXT macro...
+PYGETTEXT_MAX_MULTI_CTXT = 16
+
# Where to search contexts definitions, relative to SOURCE_DIR (defined below).
PYGETTEXT_CONTEXTS_DEFSRC = os.path.join("source", "blender", "blenfont",
"BLF_translation.h")
@@ -149,7 +152,10 @@ _str_whole_re = (
# End of loop.
"))*"
)
-_ctxt_re = r"(?P<ctxt_raw>(?:" + _str_whole_re.format(_="_ctxt") + r")|(?:[A-Z_0-9]+))"
+_ctxt_re_gen = lambda uid : r"(?P<ctxt_raw{uid}>(?:".format(uid=uid) + \
+ _str_whole_re.format(_="_ctxt{uid}".format(uid=uid)) + \
+ r")|(?:[A-Z_0-9]+))"
+_ctxt_re = _ctxt_re_gen("")
_msg_re = r"(?P<msg_raw>" + _str_whole_re.format(_="_msg") + r")"
PYGETTEXT_KEYWORDS = (() +
tuple((r"{}\(\s*" + _msg_re + r"\s*\)").format(it)
@@ -165,7 +171,11 @@ PYGETTEXT_KEYWORDS = (() +
for it in ("BMO_error_raise",)) +
tuple(("{}\\((?:[^\"',]+,)\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
- for it in ("modifier_setError",))
+ for it in ("modifier_setError",)) +
+
+ 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)
+ for it in ("BLF_I18N_MSGID_MULTI_CTXT",))
)
ESCAPE_RE = (