diff options
| author | Ralf Luther <luther.ralf@gmail.com> | 2020-12-12 21:22:50 +0100 |
|---|---|---|
| committer | Ralf Luther <luther.ralf@gmail.com> | 2020-12-12 21:22:50 +0100 |
| commit | 0f36c00fb30c19b05e32fd71a3476480977d3aca (patch) | |
| tree | fc467f6c14826ce6d65d4de7df2efbde0c701e8e | |
| parent | d4e2752e53966dcd7567e44cefdb4f3fe60f9970 (diff) | |
crowdin: adapt script to 3.5.x cli-tool
change from calling the JAR file to calling the alias executable and adapt the ReadMe a bit to reflect it.
Change-Id: I5bc71b3f99b879ca9851307ebd7676f5ee45389e
| -rwxr-xr-x | README.mkdn | 19 | ||||
| -rwxr-xr-x | crowdin_sync.py | 22 |
2 files changed, 21 insertions, 20 deletions
diff --git a/README.mkdn b/README.mkdn index aff5e2e..bc9e2fe 100755 --- a/README.mkdn +++ b/README.mkdn @@ -18,14 +18,15 @@ Prerequisites 5. The install of the package "python-gitdb" with its dependencies via a package manager or via <code>pip install gitdb</code> for python 3.6.x. -6. The prebuilt java version of crowdin-cli >= 3.2.x (see: https://github.com/crowdin/crowdin-cli/releases) is required for this to work. - It can be downloaded by pasting this link in a browser: https://downloads.crowdin.com/cli/v3/crowdin-cli.zip +6. A prebuilt java version of crowdin-cli >= 3.2.x or a packaged version (see: https://support.crowdin.com/cli-tool/) is required for + this script to work. + It can be downloaded and installed for different Linux distributions as described on the mentioned webpage. - *Note: The current limitation is that the JAR-file must be accessible via the path "/usr/local/bin/". You can of course change that in the python script file.* + *Note: The current limitation is that the script will search for an executable (alias) using the "which" command on a Linux/macOS installation.* -7. Currently the crowdin-cli tool requires either Windows10 WSL, Linux or macOS and an appropiate Java version >= 1.8.xx to work. +7. Currently the crowdin-cli tool requires either Windows10 WSL2, macOS or Linux and an appropiate Java version >= 1.8.xx to work. -8. The script relies on the XML-file <code>platform/manifest/crowdin.xml</code> of each "AICP-version" tree. +8. <code>/config/crowdin.xml</code> must be copied to <code>/q10.0/platform/manifest/crowdin.xml</code> of each "AICP-version" tree. This makes sure you will sync all the translatable and extra packages. Please remember that you should comment out the packages you already have in your local aicp_manifest.xml file as these are device dependent. @@ -33,7 +34,7 @@ Prerequisites Executing --------- -Export the needed environment variables to set the API key and the base path to your **.bashrc** or **.bash-profile**. +Export the needed environment variables to set the API key and the base path to your zsh config, **.bashrc** or **.bash-profile**. The base path should contain all AICP trees in subfolders, named after AICP branches. Needed directory structure: @@ -41,11 +42,11 @@ Needed directory structure: * /home * /your_username * /aicp - * crowdin_sync.py #Python script for the crowdin-CLI tool - * /config/q10.0.yml #Configuration file for the transaltable repositories + * /config/q10.0.yml #Configuration file for the transaltable repositories * /q10.0 * /.platform - * /manifest/crowdin.xml #Make sure that changes for used repositories are pushed in here too! + * /manifest/crowdin.xml + * crowdin_sync.py #Python script for the crowdin-CLI tool Enviroment variables to export: diff --git a/crowdin_sync.py b/crowdin_sync.py index a84bfc1..a43fef1 100755 --- a/crowdin_sync.py +++ b/crowdin_sync.py @@ -382,10 +382,10 @@ def parse_args(): def check_dependencies(): - # Check for Java version of crowdin-cli - cmd = ['find', '/usr/local/bin/crowdin-cli.jar'] + # Check if crowdin is installed somewhere + cmd = ['which', 'crowdin'] if run_subprocess(cmd, silent=True)[1] != 0: - print('You have not installed crowdin-cli.jar in its default location.', file=sys.stderr) + print('You have not installed crowdin properly.', file=sys.stderr) return False return True @@ -414,14 +414,14 @@ def check_files(files): def upload_sources_crowdin(project_id, branch, config): if config: print('\nUploading sources to Crowdin (custom config)') - check_run(['java', '-jar', '/usr/local/bin/crowdin-cli.jar', 'upload', 'sources', + check_run(['crowdin', 'upload', 'sources', f'--project-id={project_id}', f'--branch={branch}', '--auto-update', f'--config={_DIR}/config/{config}']) else: print('\nUploading sources to Crowdin (AOSP supported languages)') - check_run(['java', '-jar', '/usr/local/bin/crowdin-cli.jar', 'upload', 'sources', + check_run(['crowdin', 'upload', 'sources', f'--project-id={project_id}', f'--branch={branch}', '--auto-update', @@ -431,7 +431,7 @@ def upload_sources_crowdin(project_id, branch, config): def upload_translations_crowdin(project_id, branch, config): if config: print('\nUploading translations to Crowdin (custom config)') - check_run(['java', '-jar', '/usr/local/bin/crowdin-cli.jar', 'upload', 'translations', + check_run(['crowdin', 'upload', 'translations', f'--project-id={project_id}', f'--branch={branch}', '--import-eq-suggestions', @@ -440,7 +440,7 @@ def upload_translations_crowdin(project_id, branch, config): else: print('\nUploading translations to Crowdin ' '(AOSP supported languages)') - check_run(['java', '-jar', '/usr/local/bin/crowdin-cli.jar', 'upload', 'translations', + check_run(['crowdin', 'upload', 'translations', f'--project-id={project_id}', f'--branch={branch}', '--import-eq-suggestions', @@ -451,7 +451,7 @@ def upload_translations_crowdin(project_id, branch, config): def local_download(project_id, base_path, branch, xml, config): if config: print('\nDownloading translations from Crowdin (custom config)') - check_run(['java', '-jar', '/usr/local/bin/crowdin-cli.jar', 'download', + check_run(['crowdin', 'download', f'--project-id={project_id}', f'--branch={branch}', '--skip-untranslated-strings', @@ -460,7 +460,7 @@ def local_download(project_id, base_path, branch, xml, config): else: print('\nDownloading translations from Crowdin ' '(AOSP supported languages)') - check_run(['java', '-jar', '/usr/local/bin/crowdin-cli.jar', 'download', + check_run(['crowdin', 'download', f'--project-id={project_id}', f'--branch={branch}', '--skip-untranslated-strings', @@ -488,7 +488,7 @@ def local_download(project_id, base_path, branch, xml, config): } xf = None - cmd = ['java', '-jar', '/usr/local/bin/crowdin-cli.jar', 'list', 'translations', + cmd = ['crowdin', 'list', 'translations', f'--project-id={project_id}', '--plain', f'--config={_DIR}/config/{branch}.yml'] @@ -529,7 +529,7 @@ def download_crowdin(project_id, base_path, branch, xml, username, config): else: files = [f'{_DIR}/config/{branch}.yml'] for c in files: - cmd = ['java', '-jar', '/usr/local/bin/crowdin-cli.jar', 'list', 'sources', + cmd = ['crowdin', 'list', 'sources', f'--branch={branch}', f'--config={c}', '--plain'] comm, ret = run_subprocess(cmd) if ret != 0: |
