From 99b05424676efee3523e8c4353664c340e604c3e Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Mon, 30 May 2005 13:29:45 +0000 Subject: [PATCH] introducing translation_statistics.py as a script --- scripts/translation_statistics.py | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 scripts/translation_statistics.py diff --git a/scripts/translation_statistics.py b/scripts/translation_statistics.py new file mode 100644 index 000000000..9b9c65de1 --- /dev/null +++ b/scripts/translation_statistics.py @@ -0,0 +1,41 @@ +import os +import sys + + +def get_output(app, param=None): + if param: + command = app + ' ' + param + else: + command = app + try: + child_stdin, child_stdout = os.popen2(command) + except ValueError: + print 'Plz relax, and let python do the job. Exiting.. :(' + sys.exit() + + output = child_stdout.readlines() + child_stdout.close() + child_stdin.close() + + return output + + +def visit(arg, dirname, names): + if dirname.find('.svn') != -1: + return + if dirname.endswith('LC_MESSAGES'): + if 'gajim.po' in names: + path_to_po = os.path.join(dirname, 'gajim.po') + param = '--statistics ' + path_to_po + print path_to_po, 'has:' + get_output('msgfmt', param) + + +if __name__ == '__main__': + if len(sys.argv) != 2: + print sys.argv[0], 'po_DIRECTORY' + sys.exit(0) + + path_to_dir = sys.argv[1] + + os.path.walk(path_to_dir, visit, None)