from py_trans import PyTranslator
tr = PyTranslator()
print(tr.google("Hi", "es"))
A Fast, hassle-free way to translate text 📖
- Simple and free
- Multiple translators to choose
- Both synchronous & asynchronous versions
Engine | Function |
---|---|
Google Translate | google |
translate.com | translate_com |
MyMemory | my_memory |
Translate Dict | translate_dict |
pip3 install py-trans
Install from source
pip install git+https://github.com/Itz-fork/py-trans.git
# Sync version
from py_trans import PyTranslator
# Async version
from py_trans import Async_PyTranslator
- Detect language of the provided text
detect
-
tr.detect("Hello!")
- Translate text using Google translate
google
-
tr.google("Hello!", "es")
- Translate text using Translate.com
translate_com
-
tr.translate_com("Hello!", "es")
- Translate text using My Memory
my_memory
-
tr.my_memory("Hello!", "es")
- Translate text using Translate dict
translate_dict
-
tr.translate_dict("Hello!", "es")
-
# Sync version tr.get_lang_code("arabic") tr.get_lang_name("ar") # Async version tr.get_lang_code_async("arabic") tr.get_lang_name_async("ar")
Note
All the above examples also applies to async version (Async_PyTranslator
)