aboutsummaryrefslogtreecommitdiffstats
path: root/src/locales/guided_translation.py
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-10-22 00:36:59 -0700
committerAdam Soltys <[email protected]>2024-10-22 00:36:59 -0700
commit91ba1757448be382ea48f70c75c7e080325b96c3 (patch)
tree6803752856edcf8bf2e735e5e35eb43657acf137 /src/locales/guided_translation.py
parent185700003d926256dbc45abfaeb64cfc48b9f88b (diff)
downloadcoinos-ui-91ba1757448be382ea48f70c75c7e080325b96c3.tar.gz
coinos-ui-91ba1757448be382ea48f70c75c7e080325b96c3.zip
use libretranslate
Diffstat (limited to 'src/locales/guided_translation.py')
-rw-r--r--src/locales/guided_translation.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/locales/guided_translation.py b/src/locales/guided_translation.py
index 06b0698a..9a4a85ec 100644
--- a/src/locales/guided_translation.py
+++ b/src/locales/guided_translation.py
@@ -41,7 +41,7 @@ def localize_string(string_id, from_data, to_data, to_locale):
to_translate = to_translate[id_part]
# Google Translate API endpoint
- url = "https://translation.googleapis.com/language/translate/v2"
+ url = "http://127.0.0.1:5000/translate"
# Prepare data for POST request
data = {
@@ -55,12 +55,12 @@ def localize_string(string_id, from_data, to_data, to_locale):
headers = {"Content-Type": "application/json"}
# Make the request
- response = requests.post(url, headers=headers, params={'key': api_key}, json=data)
+ response = requests.post(url, headers=headers, json=data)
# Check if the request was successful
if response.status_code == 200:
# Parse the response and extract translation
- translated_text = response.json()['data']['translations'][0]['translatedText']
+ translated_text = response.json()['translatedText']
print("Translated text:", translated_text)
else:
print("Error while translating:", response.json())