summaryrefslogtreecommitdiffstats
path: root/pavement.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-16 15:09:23 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-16 15:09:23 +0200
commitba2861f6069f0d5f32b87734ef8960f10d6bf607 (patch)
treeec576e30b0cfe5f7531c39c6e9765a55af0c5a9e /pavement.py
parentclick on logo navigates to dashboard (diff)
downloadpyload-ba2861f6069f0d5f32b87734ef8960f10d6bf607.tar.xz
Ability to download translations in PO format from Crowdin
Diffstat (limited to 'pavement.py')
-rw-r--r--pavement.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/pavement.py b/pavement.py
index c1e6e5322..91b99911b 100644
--- a/pavement.py
+++ b/pavement.py
@@ -157,6 +157,35 @@ def upload_locale(options):
shutil.rmtree(tmp)
+@task
+@cmdopts([
+ ('key=', 'k', 'api key')
+])
+def download_translations(options):
+ """ Downloads the translated files from translation server """
+ tmp = path(mkdtemp())
+ print tmp
+
+ shutil.copy('locale/crowdin.yaml', tmp)
+ os.mkdir(tmp / 'pyLoad')
+ for f in glob('locale/*.pot'):
+ if os.path.isfile(f):
+ shutil.copy(f, tmp / 'pyLoad')
+
+ config = tmp / 'crowdin.yaml'
+ content = open(config, 'rb').read()
+ content = content.format(key=options.key, tmp=tmp)
+ f = open(config, 'wb')
+ f.write(content)
+ f.close()
+
+ call(['crowdin-cli', '-c', config, 'download'])
+
+ shutil.rmtree('locale')
+ shutil.copytree(tmp + '/pyLoad', 'locale')
+ shutil.copy(tmp + '/crowdin.yaml', 'locale')
+
+ shutil.rmtree(tmp)
@task
def tests():