# HG changeset patch # User Neil Muller # Date 1359534801 -7200 # Node ID 99e1e67f3916c68d2ac5bb9e49142f51ad416ae2 # Parent f12b187a3d5f5008929c4b4d7c945caa0441eb41 Add fuzzy/untranslated stats infowhen producing mo files diff -r f12b187a3d5f -r 99e1e67f3916 scripts/install-po.sh --- a/scripts/install-po.sh Tue Jan 29 21:46:53 2013 +0200 +++ b/scripts/install-po.sh Wed Jan 30 10:33:21 2013 +0200 @@ -8,12 +8,12 @@ molang=`echo $pofile | sed -e 's#data/po/\(.*\)\\.po#\\1#'`; mofile=`echo $pofile | sed -e 's/\\.po/.mo/'`; mkdir -p data/locale/$molang/LC_MESSAGES - scripts/msgfmt.py -o data/locale/$molang/LC_MESSAGES/suspended-sentence.mo $pofile + scripts/msgfmt.py -s -o data/locale/$molang/LC_MESSAGES/suspended-sentence.mo $pofile done for pofile in pyntnclick/data/po/*.po; do molang=`echo $pofile | sed -e 's#pyntnclick/data/po/\(.*\)\\.po#\\1#'`; mofile=`echo $pofile | sed -e 's/\\.po/.mo/'`; mkdir -p pyntnclick/data/locale/$molang/LC_MESSAGES - scripts/msgfmt.py -o pyntnclick/data/locale/$molang/LC_MESSAGES/pyntnclick-tools.mo $pofile + scripts/msgfmt.py -s -o pyntnclick/data/locale/$molang/LC_MESSAGES/pyntnclick-tools.mo $pofile done diff -r f12b187a3d5f -r 99e1e67f3916 scripts/msgfmt.py --- a/scripts/msgfmt.py Tue Jan 29 21:46:53 2013 +0200 +++ b/scripts/msgfmt.py Wed Jan 30 10:33:21 2013 +0200 @@ -23,6 +23,10 @@ -V --version Display version information and exit. + + -s + --statistics + Display fuzzy and untranslated counts """ import os @@ -36,6 +40,8 @@ MESSAGES = {} +total_fuzzy = 0 +total_untrans = 0 def usage(code, msg=''): @@ -49,8 +55,15 @@ def add(id, str, fuzzy): "Add a non-fuzzy translation to the dictionary." global MESSAGES + global total_fuzzy + global total_untrans if not fuzzy and str: MESSAGES[id] = str + if fuzzy and str: + print 'fuzzy', str + total_fuzzy += 1 + elif not str: + total_untrans += 1 @@ -197,13 +210,18 @@ def main(): try: - opts, args = getopt.getopt(sys.argv[1:], 'hVo:', - ['help', 'version', 'output-file=']) + opts, args = getopt.getopt(sys.argv[1:], 'hVso:', + ['help', 'version', 'output-file=', + 'statistics']) except getopt.error, msg: usage(1, msg) outfile = None # parse options + stats = False + global total_fuzzy + global total_untrans + for opt, arg in opts: if opt in ('-h', '--help'): usage(0) @@ -212,6 +230,8 @@ sys.exit(0) elif opt in ('-o', '--output-file'): outfile = arg + elif opt in ('-s', '--statistics'): + stats = True # do it if not args: print >> sys.stderr, 'No input file given' @@ -221,6 +241,10 @@ for filename in args: make(filename, outfile) + if stats: + print '%s: %d fuzzy strings, %d untranslated strings' % (filename, + total_fuzzy, total_untrans) + if __name__ == '__main__': main()