changeset 211:9d102737797c

Include percentage in statistics output.
author cmlenz
date Thu, 05 Jul 2007 08:02:26 +0000
parents b714a9bd4d0d
children 2c00a52bc073
files babel/messages/frontend.py
diffstat 1 files changed, 8 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/babel/messages/frontend.py
+++ b/babel/messages/frontend.py
@@ -140,17 +140,14 @@
                 infile.close()
 
             if self.statistics:
-                print repr(po_file), 'has',
                 translated = 0
-                untranslated = 0
                 for message in list(catalog)[1:]:
                     if message.string:
                         translated +=1
-                    else:
-                        untranslated +=1
-                stats_str = "%d translated strings and %d untranslated strings"
-                print stats_str % (translated, untranslated)
-                continue
+                print "%d of %d messages (%d%%) translated in %r" % (
+                    translated, len(catalog), translated * 100 // len(catalog),
+                    po_file
+                )
 
             if catalog.fuzzy and not self.use_fuzzy:
                 print 'catalog %r is marked as fuzzy, skipping' % (po_file)
@@ -710,17 +707,14 @@
                 infile.close()
 
             if options.statistics:
-                print repr(po_file), 'has',
                 translated = 0
-                untranslated = 0
                 for message in list(catalog)[1:]:
                     if message.string:
                         translated +=1
-                    else:
-                        untranslated +=1
-                stats_str = "%d translated strings and %d untranslated strings"
-                print stats_str % (translated, untranslated)
-                continue
+                print "%d of %d messages (%d%%) translated in %r" % (
+                    translated, len(catalog), translated * 100 // len(catalog),
+                    po_file
+                )
 
             if catalog.fuzzy and not options.use_fuzzy:
                 print 'catalog %r is marked as fuzzy, skipping' % (po_file)
Copyright (C) 2012-2017 Edgewall Software