summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--locale/crowdin.yaml6
-rw-r--r--pavement.py29
2 files changed, 32 insertions, 3 deletions
diff --git a/locale/crowdin.yaml b/locale/crowdin.yaml
index 4e424b069..298b878fa 100644
--- a/locale/crowdin.yaml
+++ b/locale/crowdin.yaml
@@ -1,9 +1,9 @@
project_identifier: pyload
preserve_hierarchy: true
-api_key: {key}
-base_path: {tmp}
+api_key: e28e6dd4f1a7ace092bdd1faea87f3b8
+base_path: /tmp/tmp_F2Fqx
files:
-
source: 'pyLoad/*.pot'
- translation: 'pyLoad/%two_letters_code%/LC_MESSAGES/%original_file_name%'
+ translation: 'pyLoad/%two_letters_code%/LC_MESSAGES/%file_name%.po'
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():