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
commite01e1b95afe15e7278c63789ec8d822da9d0f095 (patch)
tree6803752856edcf8bf2e735e5e35eb43657acf137 /src/locales/guided_translation.py
parentfe09eae6599c93d8d5bf0a398d11897508e2f1a4 (diff)
downloadcoinos-ui-e01e1b95afe15e7278c63789ec8d822da9d0f095.tar.gz
coinos-ui-e01e1b95afe15e7278c63789ec8d822da9d0f095.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())