diff options
author | Stefano <l.stickell@yahoo.it> | 2013-07-16 15:09:23 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-07-16 15:09:23 +0200 |
commit | ba2861f6069f0d5f32b87734ef8960f10d6bf607 (patch) | |
tree | ec576e30b0cfe5f7531c39c6e9765a55af0c5a9e | |
parent | click on logo navigates to dashboard (diff) | |
download | pyload-ba2861f6069f0d5f32b87734ef8960f10d6bf607.tar.xz |
Ability to download translations in PO format from Crowdin
-rw-r--r-- | locale/crowdin.yaml | 6 | ||||
-rw-r--r-- | pavement.py | 29 |
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(): |