Update app.py
Browse files
app.py
CHANGED
|
@@ -85,7 +85,7 @@ def translate_multiple_words(hebrew_text):
|
|
| 85 |
|
| 86 |
try:
|
| 87 |
# First translate the whole phrase
|
| 88 |
-
full_translation = GoogleTranslator(source='
|
| 89 |
|
| 90 |
# Then translate individual words if there are multiple words
|
| 91 |
words = hebrew_text.strip().split()
|
|
@@ -95,7 +95,7 @@ def translate_multiple_words(hebrew_text):
|
|
| 95 |
for i, word in enumerate(words[:5], 1): # Limit to first 5 words
|
| 96 |
if len(word.strip()) > 1: # Skip single characters
|
| 97 |
try:
|
| 98 |
-
word_translation = GoogleTranslator(source='
|
| 99 |
individual_translations.append(f"**{i}. {word}** → {word_translation}")
|
| 100 |
except:
|
| 101 |
individual_translations.append(f"**{i}. {word}** → (translation failed)")
|
|
@@ -118,7 +118,7 @@ def reverse_translate_english(hebrew_text):
|
|
| 118 |
|
| 119 |
try:
|
| 120 |
# Translate to English
|
| 121 |
-
translation_text = GoogleTranslator(source='
|
| 122 |
|
| 123 |
return translation_text
|
| 124 |
|
|
|
|
| 85 |
|
| 86 |
try:
|
| 87 |
# First translate the whole phrase
|
| 88 |
+
full_translation = GoogleTranslator(source='iw', target='en').translate(hebrew_text)
|
| 89 |
|
| 90 |
# Then translate individual words if there are multiple words
|
| 91 |
words = hebrew_text.strip().split()
|
|
|
|
| 95 |
for i, word in enumerate(words[:5], 1): # Limit to first 5 words
|
| 96 |
if len(word.strip()) > 1: # Skip single characters
|
| 97 |
try:
|
| 98 |
+
word_translation = GoogleTranslator(source='iw', target='en').translate(word)
|
| 99 |
individual_translations.append(f"**{i}. {word}** → {word_translation}")
|
| 100 |
except:
|
| 101 |
individual_translations.append(f"**{i}. {word}** → (translation failed)")
|
|
|
|
| 118 |
|
| 119 |
try:
|
| 120 |
# Translate to English
|
| 121 |
+
translation_text = GoogleTranslator(source='iw', target='en').translate(hebrew_text)
|
| 122 |
|
| 123 |
return translation_text
|
| 124 |
|