Free python library to translate text to different languages.
Project description
py-trans
from py_trans import PyTranslator
tr = PyTranslator()
print(tr.google("Hi", "es"))
A Fast, hassle-free way to translate text 📖
Features
- Simple and free
- Multiple translators to choose
- Both synchronous & asynchronous versions
Supported translators
Engine | Function |
---|---|
Google Translate | google |
translate.com | translate_com |
MyMemory | my_memory |
Translate Dict | translate_dict |
Installation
pip3 install py-trans
Install from source
pip install git+https://github.com/Itz-fork/py-trans.git
Usage
# 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")
[!NOTE] All the above examples also applies to async version
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-trans-0.6.tar.gz
(8.6 kB
view hashes)
Built Distribution
py_trans-0.6-py3-none-any.whl
(9.3 kB
view hashes)