Update to match what's currently on translate.rockbox.org
Change-Id: I9f438f9557e9a269fcd518241ad62869a1d0ef6e
diff --git a/fontstats.py b/fontstats.py
index 646dc96..fb9609a 100755
--- a/fontstats.py
+++ b/fontstats.py
@@ -1,15 +1,17 @@
#!/usr/bin/env python2.6
import re
+import sys
+import locale
import codecs
from glob import glob
-from os.path import basename
+from os.path import basename, dirname, join
from pprint import pprint
def langs():
- return glob('rockbox/apps/lang/*.lang')
+ return glob(join(dirname(__file__), 'rockbox/apps/lang/*.lang'))
def fonts():
- return glob('rockbox/fonts/*.bdf')
+ return glob(join(dirname(__file__), 'rockbox/fonts/*.bdf'))
def charusage(langfile):
usage = {}
@@ -50,11 +52,33 @@
covered += uses
return float(covered)/float(total)
-fontstats = dict([(font, charsavailable(font)) for font in fonts()])
-langusage = dict([(lang, charusage(lang)) for lang in langs()])
+def generate_summary(fontstats, langusage):
+ for langfile, charsused in sorted(langusage.items()):
+ print "[%s]" % basename(langfile).replace('.lang', '')
+ for fontfile, charsavailable in sorted(fontstats.items()):
+ coverage = calculatecoverage(charsused, charsavailable)
+ print " %s = %f" % (basename(fontfile).replace('.bdf', ''), coverage)
-for langfile, charsused in sorted(langusage.items()):
- print "[%s]" % basename(langfile).replace('.lang', '')
- for fontfile, charsavailable in sorted(fontstats.items()):
- coverage = calculatecoverage(charsused, charsavailable)
- print " %s = %f" % (basename(fontfile).replace('.bdf', ''), coverage)
+def generate_missing(fontstats, langusage):
+ for langfile, charsused in sorted(langusage.items()):
+ print "[%s]" % basename(langfile).replace('.lang', '')
+ for fontfile, charsavailable in sorted(fontstats.items()):
+ missingchars = []
+ for char, uses in charsused.iteritems():
+ if char not in charsavailable:
+ missingchars.append(char)
+ # If more than 50 characters are missing, don't print them all
+ if 25 > len(missingchars) > 0:
+ print " %s = %s" % (basename(fontfile).replace('.bdf', ''), " ".join(["%s (u+%X)" % (c, ord(c)) for c in missingchars]))
+
+
+if __name__ == '__main__':
+ sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout);
+
+ fontstats = dict([(font, charsavailable(font)) for font in fonts()])
+ langusage = dict([(lang, charusage(lang)) for lang in langs()])
+
+ if len(sys.argv) > 1 and sys.argv[1] == 'missing':
+ generate_missing(fontstats, langusage)
+ else:
+ generate_summary(fontstats, langusage)
diff --git a/ignoredrevs.list b/ignoredrevs.list
index 56660d0..a570098 100644
--- a/ignoredrevs.list
+++ b/ignoredrevs.list
@@ -1,3 +1,5 @@
+30186
+30184
30007
29969
29958
diff --git a/problems.php b/problems.php
index b5e1424..ebde189 100644
--- a/problems.php
+++ b/problems.php
@@ -13,7 +13,7 @@
}
if ($phrases === false) die("This language doesn't exist, you bad man!");
-$english = parselangfile('apps/lang/english.lang');
+$english = parselangfile('rockbox/apps/lang/english.lang');
if ($lang == 'english') {
echo <<<MOO
@@ -237,6 +237,9 @@
print(join($strings, ''));
}
+print("<!--\n");
+print_r($english);
+print("\n-->\n");
$strings = array();
foreach($phrases as $id => $phrase) {
diff --git a/templates/header.tpl b/templates/header.tpl
index 899f733..f43e596 100644
--- a/templates/header.tpl
+++ b/templates/header.tpl
@@ -2,6 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Rockbox Translations{if isset($title)} - {$title}{/if}</title>
<link rel="stylesheet" href="rockbox.css" />
</head>
diff --git a/whichfont.php b/whichfont.php
index f48b8be..21dd605 100644
--- a/whichfont.php
+++ b/whichfont.php
@@ -61,10 +61,12 @@
$langs = languageinfo();
/* Output the first row - font names */
-foreach($fontstats['english'] as $font => $coverage) {
- printf(" <td>%s</td>\n", getverticalimg($font));
+if (isset($fontstats['english'])) {
+ foreach($fontstats['english'] as $font => $coverage) {
+ printf(" <td>%s</td>\n", getverticalimg($font));
+ }
+ print(" </tr>\n </thead>\n <tbody>\n");
}
-print(" </tr>\n </thead>\n <tbody>\n");
foreach($fontstats as $lang => $stats) {
printf(" <tr>\n <td class='lang'><img src='flags/%d/%s.png' /> %s</td>\n",SMALL_FLAGSIZE, urlencode($langs[$lang]['flag']), $langs[$lang]['name']);