Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5c94ce5

Browse files
committed
write(): Karl Eichwalder points out that the #, flag comments should
be outputted just before the msgid lines.
1 parent 6302ec6 commit 5c94ce5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Tools/i18n/pygettext.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,12 @@ def write(self, fp):
338338
rentries = reverse[rkey]
339339
rentries.sort()
340340
for k, v in rentries:
341+
isdocstring = 0
341342
# If the entry was gleaned out of a docstring, then add a
342343
# comment stating so. This is to aid translators who may wish
343344
# to skip translating some unimportant docstrings.
344345
if reduce(operator.__add__, v.values()):
345-
print >> fp, '#, docstring'
346+
isdocstring = 1
346347
# k is the message string, v is a dictionary-set of (filename,
347348
# lineno) tuples. We want to sort the entries in v first by
348349
# file name and then by line number.
@@ -370,6 +371,8 @@ def write(self, fp):
370371
locline = "#:" + s
371372
if len(locline) > 2:
372373
print >> fp, locline
374+
if isdocstring:
375+
print >> fp, '#, docstring'
373376
print >> fp, 'msgid', normalize(k)
374377
print >> fp, 'msgstr ""\n'
375378

0 commit comments

Comments
 (0)