crowdin: Use environment variables for api_key & base_path
Example:
export CM_CROWDIN_API_KEY=your_api_key
export CM_AOSP_CROWDIN_API_KEY=your_aosp_api_key
export CM_CROWDIN_BASE_PATH=/mnt/cm_root
base_path is the folder that contains branch subfolders of CM trees
(cm-11.0, cm-12.0, cm-12.1)
For example, the cm-11.0 tree would be at /mnt/cm_root/cm-11.0
Change-Id: I7ca3f3cf2fe38bdedf79be8d2a9ede90ebf5cd2b
diff --git a/crowdin_sync.py b/crowdin_sync.py
index 04cf3d5..baa18e3 100755
--- a/crowdin_sync.py
+++ b/crowdin_sync.py
@@ -147,9 +147,7 @@
def check_files(branch):
- files = ['crowdin/config.yaml',
- 'crowdin/extra_packages_%s.xml' % branch,
- 'crowdin/config_aosp.yaml',
+ files = ['crowdin/extra_packages_%s.xml' % branch,
'crowdin/crowdin_%s.yaml' % branch,
'crowdin/crowdin_%s_aosp.yaml' % branch
]
@@ -171,17 +169,13 @@
print('\nUploading Crowdin source translations (AOSP supported languages)')
# Execute 'crowdin-cli upload sources' and show output
- check_run(['crowdin-cli',
- '--config=crowdin/crowdin_%s.yaml' % branch,
- '--identity=crowdin/config.yaml',
+ check_run(['crowdin-cli', '--config=crowdin/crowdin_%s.yaml' % branch,
'upload', 'sources'])
print('\nUploading Crowdin source translations '
'(non-AOSP supported languages)')
# Execute 'crowdin-cli upload sources' and show output
- check_run(['crowdin-cli',
- '--config=crowdin/crowdin_%s_aosp.yaml' % branch,
- '--identity=crowdin/config_aosp.yaml',
+ check_run(['crowdin-cli', '--config=crowdin/crowdin_%s_aosp.yaml' % branch,
'upload', 'sources'])
@@ -193,16 +187,12 @@
print('\nDownloading Crowdin translations (AOSP supported languages)')
# Execute 'crowdin-cli download' and show output
- check_run(['crowdin-cli',
- '--config=crowdin/crowdin_%s.yaml' % branch,
- '--identity=crowdin/config.yaml',
+ check_run(['crowdin-cli', '--config=crowdin/crowdin_%s.yaml' % branch,
'download', '--ignore-match'])
print('\nDownloading Crowdin translations (non-AOSP supported languages)')
# Execute 'crowdin-cli download' and show output
- check_run(['crowdin-cli',
- '--config=crowdin/crowdin_%s_aosp.yaml' % branch,
- '--identity=crowdin/config_aosp.yaml',
+ check_run(['crowdin-cli', '--config=crowdin/crowdin_%s_aosp.yaml' % branch,
'download', '--ignore-match'])
print('\nSTEP 3: Remove useless empty translations')
@@ -230,12 +220,11 @@
# Get all files that Crowdin pushed
paths = []
files = [
- ('crowdin/crowdin_%s.yaml' % branch, 'crowdin/config.yaml'),
- ('crowdin/crowdin_%s_aosp.yaml' % branch, 'crowdin/config_aosp.yaml')
+ ('crowdin/crowdin_%s.yaml' % branch),
+ ('crowdin/crowdin_%s_aosp.yaml' % branch)
]
- for c, i in files:
- cmd = ['crowdin-cli', '--config=%s' % c, '--identity=%s' % i,
- 'list', 'sources']
+ for c in files:
+ cmd = ['crowdin-cli', '--config=%s' % c, 'list', 'sources']
comm, ret = run_subprocess(cmd)
if ret != 0:
sys.exit(ret)