Make user manual translations stats available to calibre

This commit is contained in:
Kovid Goyal 2014-11-26 12:54:17 +05:30
parent c352d2eccb
commit 1c6ddefbf9
2 changed files with 8 additions and 1 deletions

1
.gitignore vendored
View File

@ -18,6 +18,7 @@ resources/builtin_recipes.xml
resources/builtin_recipes.zip resources/builtin_recipes.zip
resources/template-functions.json resources/template-functions.json
resources/editor-functions.json resources/editor-functions.json
resources/user-manual-translation-stats.json
icons/icns/*.iconset icons/icns/*.iconset
setup/installer/windows/calibre/build.log setup/installer/windows/calibre/build.log
tags tags

View File

@ -328,6 +328,12 @@ class Resources(Command): # {{{
src = '\n'.join(imports) + '\n\n' + src src = '\n'.join(imports) + '\n\n' + src
function_dict[func.name] = src function_dict[func.name] = src
json.dump(function_dict, open(dest, 'wb'), indent=4) json.dump(function_dict, open(dest, 'wb'), indent=4)
self.info('\tCreating user-manual-translation-stats.json')
d = {}
for lc, stats in json.load(open(self.j(self.d(self.SRC), 'manual', 'locale', 'completed.json'))).iteritems():
total = sum(stats.itervalues())
d[lc] = stats['translated'] / float(total)
json.dump(d, open(self.j(self.RESOURCES, 'user-manual-translation-stats.json'), 'wb'), indent=4)
def clean(self): def clean(self):
for x in ('scripts', 'ebook-convert-complete'): for x in ('scripts', 'ebook-convert-complete'):
@ -338,7 +344,7 @@ class Resources(Command): # {{{
kakasi.clean() kakasi.clean()
coffee.clean() coffee.clean()
for x in ('builtin_recipes.xml', 'builtin_recipes.zip', for x in ('builtin_recipes.xml', 'builtin_recipes.zip',
'template-functions.json'): 'template-functions.json', 'user-manual-translation-stats.json'):
x = self.j(self.RESOURCES, x) x = self.j(self.RESOURCES, x)
if os.path.exists(x): if os.path.exists(x):
os.remove(x) os.remove(x)