summaryrefslogtreecommitdiff
path: root/babel
diff options
context:
space:
mode:
authorHeungsub Lee <sub@subl.ee>2017-03-31 20:15:33 +0900
committerHeungsub Lee <sub@subl.ee>2017-03-31 20:15:33 +0900
commitb96c84e6b400e6439720b1e06b382d822a48971b (patch)
tree20e61c3ea175b147fb18e61a6dfab1608c866604 /babel
parent95b920d821b881639e5082500ced9d3e0454ee6f (diff)
downloadbabel-b96c84e6b400e6439720b1e06b382d822a48971b.tar.gz
Fix extraction bug on nested messages
It fixes !487.
Diffstat (limited to 'babel')
-rw-r--r--babel/messages/extract.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/babel/messages/extract.py b/babel/messages/extract.py
index efddbf5..ffcfac8 100644
--- a/babel/messages/extract.py
+++ b/babel/messages/extract.py
@@ -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