From 79e0713e28fc2a516784db36e2135a78d29bdf8b Mon Sep 17 00:00:00 2001 From: Foxushka <135865149+Foxushka@users.noreply.github.com> Date: Sun, 10 Sep 2023 12:07:57 +0000 Subject: [PATCH] Fix translations workflow --- chameleonultragui/lib/l10n/update.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/chameleonultragui/lib/l10n/update.py b/chameleonultragui/lib/l10n/update.py index 56ff4c8c..7582b25d 100644 --- a/chameleonultragui/lib/l10n/update.py +++ b/chameleonultragui/lib/l10n/update.py @@ -35,10 +35,13 @@ def request(method, url, data=None): f"https://crowdin.com/api/v2/projects/611911/languages/{language['data']['languageId']}/progress") except urllib.error.HTTPError: continue - if progress['data'][0]['data']['words']['translated']/progress['data'][0]['data']['words']['total'] >= 0.7: - translation = request('POST', 'https://crowdin.com/api/v2/projects/611911/translations/exports', - {'targetLanguageId': language['data']['languageId'], 'format': 'arb-export', - 'skipUntranslatedStrings': True, 'fileIds': [33]}) + if progress['data'][0]['data']['words']['translated'] / progress['data'][0]['data']['words']['total'] >= 0.7: + try: + translation = request('POST', 'https://crowdin.com/api/v2/projects/611911/translations/exports', + {'targetLanguageId': language['data']['languageId'], 'format': 'arb-export', + 'skipUntranslatedStrings': True, 'fileIds': [33]}) + except urllib.error.HTTPError: + continue export = urlopen(Request(translation['data']['url'], method='GET')).read() translations = json.loads(export.decode()) locale = translations['@@locale']