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-07-03 05:11:59 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-07-03 05:11:59 +0400
commit4aa43a0bfdc9c5172ae7cceb68f81627fac4558e (patch)
tree52e8725c4e12ead5052e34754b6ea9224103f83f
parent2ed69a95f499081aacc15c0295f3461c38430554 (diff)
Nice update to xgettext replacement, now finds 608 strings, think this covers all cases...
Will run a complete test case tomorrow, regexes killed me this evening!
-rw-r--r--release/scripts/modules/i18n/bl_process_msg.py2
-rw-r--r--release/scripts/modules/i18n/settings.py29
2 files changed, 28 insertions, 3 deletions
diff --git a/release/scripts/modules/i18n/bl_process_msg.py b/release/scripts/modules/i18n/bl_process_msg.py
index 0a28a6768e6..fcbac8a6795 100644
--- a/release/scripts/modules/i18n/bl_process_msg.py
+++ b/release/scripts/modules/i18n/bl_process_msg.py
@@ -466,6 +466,8 @@ def dump_messages(do_messages, do_checks):
keys = set()
for c in check_ctxt.values():
keys |= c
+ # XXX Temp, see below
+ c -= check_ctxt["multi_rnatip"]
for key in keys:
if key in check_ctxt["undoc_ops"]:
print("\tThe following operators are undocumented:")
diff --git a/release/scripts/modules/i18n/settings.py b/release/scripts/modules/i18n/settings.py
index 4b605e439df..7ee81c1dc47 100644
--- a/release/scripts/modules/i18n/settings.py
+++ b/release/scripts/modules/i18n/settings.py
@@ -66,9 +66,32 @@ PYGETTEXT_CONTEXTS_DEFSRC = os.path.join("source", "blender", "blenfont",
PYGETTEXT_CONTEXTS = "#define\\s+(BLF_I18NCONTEXT_[A-Z_0-9]+)\\s+\"([^\"]*)\""
# Keywords' regex.
-_str_whole_re = ("(?P<{_}>[\"'])(?:[^(?P={_})]|(?<=\\\\)(?P={_})|"
- "(?:(?P={_})\\s*\\+?\\s*(?P={_})))+(?P={_})")
-str_clean_re = "(?P<_grp>[\"'])(?P<clean>(?:[^(?P=_grp)]|(?<=\\\\)(?P=_grp))+)(?P=_grp)"
+# XXX Most unfortunately, we can't use named backreferences inside character sets,
+# which makes the regexes even more twisty... :/
+_str_base = (
+ # Match void string
+ "(?P<{_}1>[\"'])(?P={_}1)" # Get opening quote (' or "), and closing immediately.
+ "|"
+ # Or match non-void string
+ "(?P<{_}2>[\"'])" # Get opening quote (' or ").
+ "(?{capt}(?:"
+ # This one is for crazy things like "hi \\\\\" folks!"...
+ r"(?:(?!<\\)(?:\\\\)*\\(?=(?P={_}2)))|"
+ # The most common case.
+ ".(?!(?P={_}2))"
+ ")+.)" # Don't forget the last char!
+ "(?P={_}2)" # And closing quote.
+)
+str_clean_re = _str_base.format(_="g", capt="P<clean>")
+# Here we have to consider two different cases (empty string and other).
+_str_whole_re = (
+ _str_base.format(_="{_}1_", capt=":") +
+ # Optional loop start, this handles "split" strings...
+ "(?:(?<=[\"'])\\s*(?=[\"'])(?:"
+ + _str_base.format(_="{_}2_", capt=":") +
+ # End of loop.
+ "))*"
+)
_ctxt_re = r"(?P<ctxt_raw>(?:" + _str_whole_re.format(_="_ctxt") + r")|(?:[A-Z_0-9]+))"
_msg_re = r"(?P<msg_raw>" + _str_whole_re.format(_="_msg") + r")"
PYGETTEXT_KEYWORDS = (() +