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/config.yaml b/crowdin/config.yaml
deleted file mode 100644
index 37dd46c..0000000
--- a/crowdin/config.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-# config_cm.yaml
-#
-# Crowdin configuration file for CyanogenMod
-#
-# Copyright (C) 2014 The CyanogenMod Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-api_key: your_api_key
-base_path: your/path
diff --git a/crowdin/config_aosp.yaml b/crowdin/config_aosp.yaml
deleted file mode 100644
index af2e56e..0000000
--- a/crowdin/config_aosp.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-# config_aosp.yaml
-#
-# Crowdin configuration file for CyanogenMod's
-# additional languages not supported by AOSP
-#
-# Copyright (C) 2014 The CyanogenMod Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-api_key: your_api_key
-base_path: your/path
diff --git a/crowdin/crowdin_cm-11.0.yaml b/crowdin/crowdin_cm-11.0.yaml
index f270e56..95bf50a 100644
--- a/crowdin/crowdin_cm-11.0.yaml
+++ b/crowdin/crowdin_cm-11.0.yaml
@@ -16,6 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+api_key_env: CM_CROWDIN_API_KEY
+base_path_env: CM_CROWDIN_BASE_PATH
project_identifier: cyanogenmod
preserve_hierarchy: true
diff --git a/crowdin/crowdin_cm-11.0_aosp.yaml b/crowdin/crowdin_cm-11.0_aosp.yaml
index 895325c..85f6fb2 100644
--- a/crowdin/crowdin_cm-11.0_aosp.yaml
+++ b/crowdin/crowdin_cm-11.0_aosp.yaml
@@ -17,6 +17,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+api_key_env: CM_AOSP_CROWDIN_API_KEY
+base_path_env: CM_CROWDIN_BASE_PATH
project_identifier: cyanogenmod-aosp
preserve_hierarchy: true
diff --git a/crowdin/crowdin_cm-12.0.yaml b/crowdin/crowdin_cm-12.0.yaml
index 2baff0f..7161555 100644
--- a/crowdin/crowdin_cm-12.0.yaml
+++ b/crowdin/crowdin_cm-12.0.yaml
@@ -16,6 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+api_key_env: CM_CROWDIN_API_KEY
+base_path_env: CM_CROWDIN_BASE_PATH
project_identifier: cyanogenmod
preserve_hierarchy: true
diff --git a/crowdin/crowdin_cm-12.0_aosp.yaml b/crowdin/crowdin_cm-12.0_aosp.yaml
index e3db206..6e953b8 100644
--- a/crowdin/crowdin_cm-12.0_aosp.yaml
+++ b/crowdin/crowdin_cm-12.0_aosp.yaml
@@ -17,6 +17,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+api_key_env: CM_AOSP_CROWDIN_API_KEY
+base_path_env: CM_CROWDIN_BASE_PATH
project_identifier: cyanogenmod-aosp
preserve_hierarchy: true
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)