need help with a translation issue
Quentin Bock
qberz2005 at gmail.com
Sat Apr 17 18:56:35 EDT 2021
I'm trying to take the user input and let them change the target language
or dest
code:
from deep_translator import GoogleTranslator
import googletrans
import sys
language_list = googletrans.LANGUAGES
print(language_list)
feedback = input("Would you like to translate a sentence of your own?
(yes/no)")
if feedback == 'no':
sys.exit()
while feedback == 'yes':
user_choice = input ("Enter a language (the abbreviation or correctly
spelled name of the language): ").lower()
user_sentence = input("Enter a sentence you want translated: ")
user_translation = GoogleTranslator(source='en',
target=user_choice).translate(user_sentence)
print(user_translation)
feedback = input ("Would you like to translate a sentence of your own?
(yes/no)")
if feedback == 'no':
sys.exit()
when ran, this will bring an error saying that your inputted language is
not supported
why is this?
More information about the Python-list
mailing list