From: Heungsub Lee Date: Fri, 31 Mar 2017 11:15:33 +0000 (+0900) Subject: Fix extraction bug on nested messages X-Git-Tag: v2.5.0~10^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F488%2Fhead;p=thirdparty%2Fbabel.git Fix extraction bug on nested messages It fixes !487. --- diff --git a/babel/messages/extract.py b/babel/messages/extract.py index efddbf5e..ffcfac86 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