Tools: allow to run updatets script from updatecrowdin

This commit is contained in:
Yorik van Havre
2021-07-01 13:57:24 +02:00
parent da508e30b0
commit c4e9be172b

View File

@@ -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__)