mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
A spot of refactoring
This commit is contained in:
parent
551e8f234e
commit
7de2e366cf
@ -518,14 +518,20 @@ class GetTranslations(Translations): # {{{
|
|||||||
def run(self, opts):
|
def run(self, opts):
|
||||||
require_git_master()
|
require_git_master()
|
||||||
if opts.check_for_errors:
|
if opts.check_for_errors:
|
||||||
return self.check_for_errors()
|
self.check_all()
|
||||||
|
return
|
||||||
self.tx('pull -a')
|
self.tx('pull -a')
|
||||||
if self.is_modified:
|
if not self.is_modified:
|
||||||
|
self.info('No translations were updated')
|
||||||
|
return
|
||||||
|
self.upload_to_vcs()
|
||||||
|
self.check_all()
|
||||||
|
|
||||||
|
def check_all(self):
|
||||||
self.check_for_errors()
|
self.check_for_errors()
|
||||||
self.check_for_user_manual_errors()
|
self.check_for_user_manual_errors()
|
||||||
self.upload_to_vcs()
|
if self.is_modified:
|
||||||
else:
|
self.upload_to_vcs('Fixed translations')
|
||||||
print ('No translations were updated')
|
|
||||||
|
|
||||||
def check_for_user_manual_errors(self):
|
def check_for_user_manual_errors(self):
|
||||||
self.info('Checking user manual translations...')
|
self.info('Checking user manual translations...')
|
||||||
@ -619,11 +625,11 @@ class GetTranslations(Translations): # {{{
|
|||||||
|
|
||||||
subprocess.check_call(['pomerge', '-t', tpath, '-i', errors, '-o', tpath])
|
subprocess.check_call(['pomerge', '-t', tpath, '-i', errors, '-o', tpath])
|
||||||
|
|
||||||
def upload_to_vcs(self):
|
def upload_to_vcs(self, msg=None):
|
||||||
print ('Uploading updated translations to version control')
|
self.info('Uploading updated translations to version control')
|
||||||
cc = partial(subprocess.check_call, cwd=self.TRANSLATIONS)
|
cc = partial(subprocess.check_call, cwd=self.TRANSLATIONS)
|
||||||
cc('git add */*.po'.split())
|
cc('git add */*.po'.split())
|
||||||
cc('git commit -am'.split() + ['Updated translations'])
|
cc('git commit -am'.split() + [msg or 'Updated translations'])
|
||||||
cc('git push'.split())
|
cc('git push'.split())
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user