CI: Automatically synchronize translations with CrowdIn
This commit is contained in:
@@ -325,12 +325,15 @@ class CrowdinUpdater:
|
||||
|
||||
|
||||
def load_token():
|
||||
# load API token stored in ~/.crowdin-freecad-token
|
||||
config_file = os.path.expanduser("~") + os.sep + ".crowdin-freecad-token"
|
||||
# try to read token from ~/.crowdin-freecad-token
|
||||
config_file = os.path.join(os.path.expanduser("~"), ".crowdin-freecad-token")
|
||||
if os.path.exists(config_file):
|
||||
with open(config_file) as file:
|
||||
return file.read().strip()
|
||||
return None
|
||||
with open(config_file, "r") as file:
|
||||
token = file.read().strip()
|
||||
if token:
|
||||
return token
|
||||
# if file does'nt exists read from CROWDIN_TOKEN
|
||||
return os.environ.get("CROWDIN_TOKEN")
|
||||
|
||||
|
||||
def updateqrc(qrcpath, lncode):
|
||||
@@ -522,9 +525,9 @@ if __name__ == "__main__":
|
||||
|
||||
project_identifier = os.environ.get("CROWDIN_PROJECT_ID")
|
||||
if not project_identifier:
|
||||
project_identifier = "freecad"
|
||||
# print('CROWDIN_PROJECT_ID env var must be set')
|
||||
# sys.exit()
|
||||
# project_identifier = "freecad"
|
||||
print("CROWDIN_PROJECT_ID env var must be set")
|
||||
sys.exit()
|
||||
|
||||
updater = CrowdinUpdater(token, project_identifier)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user