You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Andreas Stieger <an...@gmx.de> on 2013/06/28 01:09:39 UTC

[PATCH] make po-merge.py count fuzzy strings

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


Re: [PATCH] make po-merge.py count fuzzy strings

Posted by Andreas Stieger <an...@gmx.de>.
On 28/06/13 01:08, Daniel Shahaf wrote:
> Andreas Stieger wrote on Fri, Jun 28, 2013 at 00:09:39 +0100:
>> make po-merge.py count fuzzy strings 
> Personally I would have done something like if c.startswith('#,') and
> 'fuzzy' in c.split(', '): to match 'fuzzy' only as a whole word.

Good point. r1497857

Andreas

Re: [PATCH] make po-merge.py count fuzzy strings

Posted by Daniel Shahaf <da...@elego.de>.
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__':