mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Track translations in their own reporsitory
This commit is contained in:
parent
22d42b732d
commit
107303bf06
@ -265,10 +265,18 @@ class GetTranslations(Translations): # {{{
|
|||||||
|
|
||||||
description = 'Get updated translations from Transifex'
|
description = 'Get updated translations from Transifex'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_modified(self):
|
||||||
|
return bool(subprocess.check_output('git status --porcelain'.split(), cwd=self.TRANSLATIONS))
|
||||||
|
|
||||||
def run(self, opts):
|
def run(self, opts):
|
||||||
require_git_master()
|
require_git_master()
|
||||||
self.tx('pull -a')
|
self.tx('pull -a')
|
||||||
self.check_for_errors()
|
if self.is_modified:
|
||||||
|
self.check_for_errors()
|
||||||
|
self.upload_to_vcs()
|
||||||
|
else:
|
||||||
|
print ('No translations were updated')
|
||||||
|
|
||||||
def check_for_errors(self):
|
def check_for_errors(self):
|
||||||
errors = os.path.join(tempfile.gettempdir(), 'calibre-translation-errors')
|
errors = os.path.join(tempfile.gettempdir(), 'calibre-translation-errors')
|
||||||
@ -310,6 +318,13 @@ class GetTranslations(Translations): # {{{
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def upload_to_vcs(self):
|
||||||
|
print ('Uploading updated translations to version control')
|
||||||
|
cc = partial(subprocess.check_call, cwd=self.TRANSLATIONS)
|
||||||
|
cc('git add */*.po'.split())
|
||||||
|
cc('git commit -am'.split() + ['Updated translations'])
|
||||||
|
cc('git push'.split())
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class ISO639(Command): # {{{
|
class ISO639(Command): # {{{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user