mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make user manual translations stats available to calibre
This commit is contained in:
parent
c352d2eccb
commit
1c6ddefbf9
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@ resources/builtin_recipes.xml
|
||||
resources/builtin_recipes.zip
|
||||
resources/template-functions.json
|
||||
resources/editor-functions.json
|
||||
resources/user-manual-translation-stats.json
|
||||
icons/icns/*.iconset
|
||||
setup/installer/windows/calibre/build.log
|
||||
tags
|
||||
|
@ -328,6 +328,12 @@ class Resources(Command): # {{{
|
||||
src = '\n'.join(imports) + '\n\n' + src
|
||||
function_dict[func.name] = src
|
||||
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):
|
||||
for x in ('scripts', 'ebook-convert-complete'):
|
||||
@ -338,7 +344,7 @@ class Resources(Command): # {{{
|
||||
kakasi.clean()
|
||||
coffee.clean()
|
||||
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)
|
||||
if os.path.exists(x):
|
||||
os.remove(x)
|
||||
|
Loading…
x
Reference in New Issue
Block a user