]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Fix extraction bug on nested messages 488/head
authorHeungsub Lee <sub@subl.ee>
Fri, 31 Mar 2017 11:15:33 +0000 (20:15 +0900)
committerHeungsub Lee <sub@subl.ee>
Fri, 31 Mar 2017 11:15:33 +0000 (20:15 +0900)
It fixes !487.

babel/messages/extract.py

index efddbf5e691c23c9a2e7cf1af5308e72897a7e90..ffcfac86b851f105363f17bd12de52a9478b7e9d 100644 (file)
@@ -445,7 +445,8 @@ def extract_python(fileobj, keywords, comment_tags, options):
                     translator_comments.append((lineno, value))
                     break
         elif funcname and call_stack == 0:
-            if tok == OP and value == ')':
+            nested = (tok == NAME and value in keywords)
+            if (tok == OP and value == ')') or nested:
                 if buf:
                     messages.append(''.join(buf))
                     del buf[:]
@@ -470,6 +471,8 @@ def extract_python(fileobj, keywords, comment_tags, options):
                 messages = []
                 translator_comments = []
                 in_translator_comments = False
+                if nested:
+                    funcname = value
             elif tok == STRING:
                 # Unwrap quotes in a safe manner, maintaining the string's
                 # encoding