We translate a text in a few lines using
deep-translator. It supports dozens of languages: from English and Russian to Japanese and Arabic.Install the library:
pip install deep-translator
Example of use:
from deep_translator import GoogleTranslator
text = "Hello, how are you?"
result = GoogleTranslator(source="ru", target="en").translate(text)
print("Original:", text)
print("Translation:", result)
Mass translation of a list:
texts = ["Hello", "What's your name?", "See you later"]
for t in texts:
print("→", GoogleTranslator(source="ru", target="es").translate(t))
🔥 We get a mini-Google Translate right in Python: you can embed it in a chatbot, use it in notes, or automate work with the API.
🚪 @DataScience4