mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Fix wrong output of po statistics script.
This commit is contained in:
parent
b9cc642856
commit
6b88e4bf3b
@ -38,6 +38,7 @@ ommitted = ('en.po')
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import codecs
|
import codecs
|
||||||
|
import subprocess
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
# Reset the locale
|
# Reset the locale
|
||||||
@ -112,17 +113,14 @@ def run_msgfmt(pofile):
|
|||||||
prop["email"] = header['Last-Translator'].split('<')[1][:-1]
|
prop["email"] = header['Last-Translator'].split('<')[1][:-1]
|
||||||
prop["email"] = prop["email"].replace("@", " () ")
|
prop["email"] = prop["email"].replace("@", " () ")
|
||||||
prop["email"] = prop["email"].replace(".", " ! ")
|
prop["email"] = prop["email"].replace(".", " ! ")
|
||||||
translator = header['Last-Translator'].split('<')[0].strip()
|
prop["translator"] = header['Last-Translator'].split('<')[0].strip()
|
||||||
try:
|
|
||||||
prop["translator"] = translator.encode('ascii','xmlcharrefreplace')
|
|
||||||
except LookupError:
|
|
||||||
prop["translator"] = translator
|
|
||||||
|
|
||||||
P = Popen("msgfmt --statistics -o %s %s" % (gmofile, pofile),
|
msg = subprocess.check_output(["msgfmt", "--statistics",
|
||||||
shell=True, stdin=PIPE, stdout=PIPE, close_fds=True)
|
"-o", gmofile, # FIXME: do we really want a gmofile as side-effect?
|
||||||
extract_number(P.stdout.readline().decode(),
|
pofile], stderr=subprocess.STDOUT)
|
||||||
('translated', 'fuzzy', 'untranslated'),
|
if sys.version_info[0] > 2:
|
||||||
prop)
|
msg = msg.decode('utf8')
|
||||||
|
extract_number(msg, ('translated', 'fuzzy', 'untranslated'), prop)
|
||||||
return """
|
return """
|
||||||
array ( 'langcode' => '%(langcode)s', "date" => "%(date)s",
|
array ( 'langcode' => '%(langcode)s', "date" => "%(date)s",
|
||||||
"msg_tr" => %(translated)d, "msg_fu" => %(fuzzy)d, "msg_nt" => %(untranslated)d,
|
"msg_tr" => %(translated)d, "msg_fu" => %(fuzzy)d, "msg_nt" => %(untranslated)d,
|
||||||
@ -144,4 +142,6 @@ $branch_tag = "%s";
|
|||||||
|
|
||||||
// The data itself
|
// The data itself
|
||||||
$podata = array (%s
|
$podata = array (%s
|
||||||
)?>""" % (sys.argv[1], branch_tag, ",".join([run_msgfmt(po) for po in sys.argv[2:] if po not in ommitted])))
|
)?>""" % (sys.argv[1], branch_tag,
|
||||||
|
",".join([run_msgfmt(po) for po in sys.argv[2:]
|
||||||
|
if po not in ommitted])))
|
||||||
|
Loading…
Reference in New Issue
Block a user