Update app.py
Browse files84 unmodified lines858687888990913 unmodified lines959697989910010116 unmodified lines11811912012112212312484 unmodified linestry:# First translate the whole phrasefull_translation = GoogleTranslator(source='he', target='en').translate(hebrew_text)# Then translate individual words if there are multiple wordswords = hebrew_text.strip().split()3 unmodified linesfor i, word in enumerate(words[:5], 1): # Limit to first 5 wordsif len(word.strip()) > 1: # Skip single characterstry:word_translation = GoogleTranslator(source='he', target='en').translate(word)individual_translations.append(f"**{i}. {word}** → {word_translation}")except:individual_translations.append(f"**{i}. {word}** → (translation failed)")16 unmodified linestry:# Translate to Englishtranslation_text = GoogleTranslator(source='he', target='en').translate(hebrew_text)return translation_text84 unmodified lines858687888990913 unmodified lines959697989910010116 unmodified lines11811912012112212312484 unmodified linestry:# First translate the whole phrasefull_translation = GoogleTranslator(source='iw', target='en').translate(hebrew_text)# Then translate individual words if there are multiple wordswords = hebrew_text.strip().split()3 unmodified linesfor i, word in enumerate(words[:5], 1): # Limit to first 5 wordsif len(word.strip()) > 1: # Skip single characterstry:word_translation = GoogleTranslator(source='iw', target='en').translate(word)individual_translations.append(f"**{i}. {word}** → {word_translation}")except:individual_translations.append(f"**{i}. {word}** → (translation failed)")16 unmodified linestry:# Translate to Englishtranslation_text = GoogleTranslator(source='iw', target='en').translate(hebrew_text)return translation_text
app.py+3-3