mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix calculation of user manual translation stats
This commit is contained in:
parent
c5ee7f9080
commit
9489286782
@ -327,20 +327,19 @@ class Translations(POT): # {{{
|
|||||||
stats = tuple(parallel_check_output(jobs, self.info))
|
stats = tuple(parallel_check_output(jobs, self.info))
|
||||||
translated = untranslated = 0
|
translated = untranslated = 0
|
||||||
for line in stats:
|
for line in stats:
|
||||||
m = re.search('(\d+).+(\d+)', line)
|
nums = tuple(map(int, re.findall(r'\d+', line)))
|
||||||
if m is None:
|
translated += nums[0]
|
||||||
translated += int(re.search('\d+', line).group())
|
if len(nums) > 1:
|
||||||
else:
|
untranslated += nums[1]
|
||||||
translated += int(m.group(1))
|
|
||||||
untranslated += int(m.group(2))
|
|
||||||
stats = {'translated':translated, 'untranslated':untranslated}
|
stats = {'translated':translated, 'untranslated':untranslated}
|
||||||
with open(self.j(self.d(dest), 'stats.json'), 'wb') as f:
|
with open(self.j(self.d(dest), 'stats.json'), 'wb') as f:
|
||||||
json.dump(stats, f)
|
json.dump(stats, f)
|
||||||
total = translated + untranslated
|
total = translated + untranslated
|
||||||
if total and (translated / float(total)) > 0.75:
|
# Raise the 20% threshold in the future
|
||||||
|
if total and (translated / float(total)) > 0.2:
|
||||||
complete[x] = stats
|
complete[x] = stats
|
||||||
with open(self.j(destbase, 'completed.json'), 'wb') as f:
|
with open(self.j(destbase, 'completed.json'), 'wb') as f:
|
||||||
json.dump(complete, f)
|
json.dump(complete, f, indent=True, sort_keys=True)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if os.path.exists(self.stats):
|
if os.path.exists(self.stats):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user