From c4e9be172bf7bd401f41a2cf70c41caa8ed81c4c Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 1 Jul 2021 13:57:24 +0200 Subject: [PATCH] Tools: allow to run updatets script from updatecrowdin --- src/Tools/updatecrowdin.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Tools/updatecrowdin.py b/src/Tools/updatecrowdin.py index 0442f375ec..bdf3cd8e17 100755 --- a/src/Tools/updatecrowdin.py +++ b/src/Tools/updatecrowdin.py @@ -24,13 +24,13 @@ # *************************************************************************** """ -This utility offers several commands to interact with the FreeCAD project on -crowdin. For it to work, you need a ~/.crowdin-freecad-token file in your -user's folder, that contains the API access token that gives access to the -crowdin FreeCAD project. The API token can also be specified in the +This utility offers several commands to interact with the FreeCAD project on +crowdin. For it to work, you need a ~/.crowdin-freecad-token file in your +user's folder, that contains the API access token that gives access to the +crowdin FreeCAD project. The API token can also be specified in the CROWDIN_TOKEN environment variable. -The CROWDIN_PROJECT_ID environment variable can be used to use this script +The CROWDIN_PROJECT_ID environment variable can be used to use this script in other projects. Usage: @@ -39,16 +39,18 @@ Usage: Available commands: + gather: update all ts files found in the source code + (runs updatets.py) status: prints a status of the translations - update: updates crowdin the current version of .ts files + update / upload: updates crowdin the current version of .ts files found in the source code - build: builds a new downloadable package on crowdin with all + build: builds a new downloadable package on crowdin with all translated strings - build-status: shows the status of the current builds available on + build-status: shows the status of the current builds available on crowdin - download [build_id]: downloads build specified by 'build_id' or latest if + download [build_id]: downloads build specified by 'build_id' or latest if build_id is left blank - apply / install: applies downloaded translations to source code + apply / install: applies downloaded translations to source code (runs updatefromcrowdin.py) Example: @@ -251,7 +253,7 @@ if __name__ == "__main__": print(f" id: {item['id']} progress: {item['progress']}% status: {item['status']}") print('please specify a build id') - elif command == "update": + elif command in ["update","upload"]: # Find all ts files. However, this contains the lang-specific files too. Let's drop those all_ts_files = glob.glob('../**/*.ts', recursive=True) # Remove the file extensions @@ -269,5 +271,9 @@ if __name__ == "__main__": import updatefromcrowdin updatefromcrowdin.run() + elif command == "gather": + import updatets + updatets.main() + else: print(__doc__)