Andreas Stieger wrote on Fri, Jun 28, 2013 at 00:09:39 +0100: > Hello, > > while merging some translation updates to the release branch I noticed that > po-merge.py doesn't count strings marked as fuzzy. > > [[[ > make po-merge.py count fuzzy strings > > * tools/dev/po-merge.py > (main): count and print number of fuzzy strings > ]]] > > With kind regards, > Andreas Stieger >
> Index: tools/dev/po-merge.py > =================================================================== > --- tools/dev/po-merge.py (revision 1497603) > +++ tools/dev/po-merge.py (working copy) > @@ -146,6 +146,7 @@ def main(argv): > string_count = 0 > update_count = 0 > untranslated = 0 > + fuzzy = 0 > while True: > comments, msgid, msgid_plural, msgstr = parse_translation(infile) > if not comments and msgid is None: > @@ -180,11 +181,15 @@ def main(argv): > for m in msgstr: > if m == '""': > untranslated += 1 > + for c in comments: > + if c.startswith('#,') and 'fuzzy' in c: > + fuzzy += 1 > Personally I would have done something like if c.startswith('#,') and 'fuzzy' in c.split(', '): to match 'fuzzy' only as a whole word. +1 to commit, with or without that amendment. Daniel > # We're done. Tell the user what we did. > print(('%d strings updated. ' > + '%d fuzzy strings. ' > '%d of %d strings are still untranslated (%.0f%%).' % > - (update_count, untranslated, string_count, > + (update_count, fuzzy, untranslated, string_count, > 100.0 * untranslated / string_count))) > > if __name__ == '__main__':