kambris commited on
Commit
f095d95
·
verified ·
1 Parent(s): 22345d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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='he', target='en').translate(hebrew_text)
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='he', 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,7 +118,7 @@ def reverse_translate_english(hebrew_text):
118
 
119
  try:
120
  # Translate to English
121
- translation_text = GoogleTranslator(source='he', target='en').translate(hebrew_text)
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