Skip to content

Instantly share code, notes, and snippets.

@JayantGoel001
Created January 9, 2021 12:35
Show Gist options
  • Save JayantGoel001/115a7ff85d179731e3b9d0ca16e22008 to your computer and use it in GitHub Desktop.
Save JayantGoel001/115a7ff85d179731e3b9d0ca16e22008 to your computer and use it in GitHub Desktop.
Convert Any Text Language to Any Other Text Language using googletrans
from googletrans import Translator
text = '''
J'ai erré seul comme un nuage
Qui flotte sur les hautes vallées et collines,
Quand tout à coup j'ai vu une foule,
Une foule, de jonquilles dorées;
Au bord du lac, sous les arbres,
flottant et dansant dans la brise.
'''
translator = Translator()
lang = translator.detect(text)
print(lang)
translated_lang = translator.translate(text, dest='en', src='fr')
print(translated_lang)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment