X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=po%2Fpostats.py;h=fe486517c0e7cb1c193b9e43c0f4f3211c2537fc;hb=9633b1b9c5f9d272766f382e8e9365b8d6bea546;hp=64aa0ad318506c96430ba42c829ef7e1333444c9;hpb=d3752672b3f8fc05d6b1bffb7815c568a4a0c7c7;p=lyx.git diff --git a/po/postats.py b/po/postats.py old mode 100644 new mode 100755 index 64aa0ad318..fe486517c0 --- a/po/postats.py +++ b/po/postats.py @@ -24,21 +24,24 @@ to retrieve the number of translated/fuzzy/untranslated messages, and generates a PHP web page. Invocation: - postats.py po_files > "pathToWebPages"/i18n.inc + postats.py lyx_version po_files > "pathToWebPages"/i18n.inc """ +from __future__ import print_function -# modify this when you change version +# modify this when you change branch # Note that an empty lyx_branch variable (ie svn trunk) # will "do the right thing". -lyx_version="1.6.0svn" lyx_branch="" +# these po-files will be skipped: +ommitted = ('en.po') import os import sys # Reset the locale import locale -locale.setlocale(locale.LC_ALL, '') +locale.setlocale(locale.LC_ALL, 'C') +os.environ['LC_ALL'] = 'C' def extract_number(line, issues, prop): """ @@ -91,7 +94,7 @@ def run_msgfmt(pofile): The function runs msgfmt on it and returns corresponding php code. """ if not pofile.endswith('.po'): - print >> sys.stderr, "%s is not a po file" % pofile + print("%s is not a po file" % pofile, file=sys.stderr) sys.exit(1) dirname = os.path.dirname(pofile) @@ -105,6 +108,8 @@ def run_msgfmt(pofile): prop["langcode"] = os.path.basename(pofile)[:-3] prop["date"] = header['PO-Revision-Date'].split()[0] prop["email"] = header['Last-Translator'].split('<')[1][:-1] + prop["email"] = prop["email"].replace("@", " () ") + prop["email"] = prop["email"].replace(".", " ! ") translator = header['Last-Translator'].split('<')[0].strip() try: prop["translator"] = translator.decode(charset).encode('ascii','xmlcharrefreplace') @@ -123,12 +128,12 @@ array ( 'langcode' => '%(langcode)s', "date" => "%(date)s", if __name__ == "__main__": if lyx_branch: - branch_tag = "branches/%s" % lyx_branch + branch_tag = lyx_branch else: - branch_tag = "trunk" + branch_tag = "master" - print """ -""" % (lyx_version, branch_tag, ",".join([run_msgfmt(po) for po in sys.argv[1:]])) +)?>""" % (sys.argv[1], branch_tag, ",".join([run_msgfmt(po) for po in sys.argv[2:] if po not in ommitted])))