Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hacker <dd0t@users.sourceforge.net>2012-11-13 01:36:09 +0400
committerStefan Hacker <dd0t@users.sourceforge.net>2012-11-13 01:36:09 +0400
commitbecbda54738ab976342420faf684e9be417132e0 (patch)
treed94ba6a46031b58a8f28913d225bdc36cc051646
parent1922df797ddabe280600a5870057f6c44a950c59 (diff)
Add a small script to pull translation state from compile logs.1.2.4-beta1
-rw-r--r--scripts/transtate.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/transtate.py b/scripts/transtate.py
new file mode 100644
index 000000000..e601e21a7
--- /dev/null
+++ b/scripts/transtate.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# Extracts the progress of translations from the compilation
+# log in easily readable form. Make sure to delete all .qm
+# files beforehand.
+#
+# Usage: cat log | .\transtate.py
+#
+
+import sys
+import re
+
+def n(val):
+ return (int(val) if val else 0)
+
+if __name__ == "__main__":
+
+ #--Regex matches strings like
+ #
+ #Updating 'mumble_zh_CN.qm'...
+ # Generated 1421 translation(s) (1145 finished and 276 unfinished)
+ # Ignored 89 untranslated source text(s)
+ # s:\dev\QtMumble\bin\lrelease.exe mumble_zh_TW.ts
+ #Updating 'mumble_zh_TW.qm'...
+ # Generated 664 translation(s) (594 finished and 70 unfinished)
+ # Ignored 846 untranslated source text(s)
+
+ update = re.compile(r"Updating '([\w\.]+)'\.\.\.\s+Generated (\d+) translation\(s\) \((\d+) finished and (\d+) unfinished\)(?:\s+ Ignored (\d+) untranslated source text\(s\))?")
+
+ langs = 0
+ s = 's'
+
+ sortedbyuntranslated = sorted(update.findall(sys.stdin.read()), key=lambda s: (float(s[2]) / (n(s[1]) + n(s[4]))) if n(s[1]) else 10, reverse=True)
+
+ for lang, total, finished, unfinished, ignored in sortedbyuntranslated:
+ print "%s:" % lang
+
+ if int(total) == 0:
+ print " Source language"
+ else:
+ realtotal = n(total) + n(ignored)
+ percent = float(finished) / realtotal * 100
+
+ print " %d marked unfinished" % (n(unfinished))
+
+ if n(ignored):
+ print " %d untranslated." % (n(ignored))
+
+ print " => %d%% done (total %d + %d)." % (percent, n(total), n(ignored))
+ print
+ langs += 1
+
+ print "Number of languages: %d" % langs
+
+
+
+ \ No newline at end of file