if in_translator_comments is True:
translator_comments.append(value[1:].strip())
continue
- for comment_tags in comment_tags:
- if comment_tags in value:
+ for comment_tag in comment_tags:
+ if comment_tag in value:
if in_translator_comments is not True:
in_translator_comments = True
translator_comments.append(value[1:].strip())
# NOTE: A translation comment
# with a second line
msg = _(u'Foo Bar')
+""")
+ messages = list(extract.extract_python(buf, ('_',), ['NOTE'], {}))
+ self.assertEqual('Foo Bar', messages[0][2])
+ self.assertEqual(['NOTE: A translation comment', 'with a second line'],
+ messages[0][3])
+
+ def test_translator_comments_with_previous_non_translator_comments(self):
+ buf = StringIO("""
+# This shouldn't be in the output
+# because it didn't start with a comment tag
+# NOTE: A translation comment
+# with a second line
+msg = _(u'Foo Bar')
""")
messages = list(extract.extract_python(buf, ('_',), ['NOTE'], {}))
self.assertEqual('Foo Bar', messages[0][2])