Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itz-fork/py-trans
Text translation library with wrappers for Google Translate, My memory and more...
https://github.com/itz-fork/py-trans
google-translate google-translate-python mymemory python-library text-translation translate translation translator
Last synced: about 1 month ago
JSON representation
Text translation library with wrappers for Google Translate, My memory and more...
- Host: GitHub
- URL: https://github.com/itz-fork/py-trans
- Owner: Itz-fork
- License: mit
- Created: 2021-09-11T16:17:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-13T02:52:31.000Z (about 1 year ago)
- Last Synced: 2024-11-29T07:37:09.880Z (about 2 months ago)
- Topics: google-translate, google-translate-python, mymemory, python-library, text-translation, translate, translation, translator
- Language: Python
- Homepage: https://itz-fork.github.io/py-trans/
- Size: 154 KB
- Stars: 16
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-trans
```py
from py_trans import PyTranslatortr = 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](https://translate.google.com/) | `google` |
|[translate.com](https://www.translate.com/) | `translate_com` |
|[MyMemory](https://mymemory.translated.net/) | `my_memory` |
|[Translate Dict](https://www.translatedict.com/) | `translate_dict` |## Installation
```sh
pip3 install py-trans
```Install from source
```sh
pip install git+https://github.com/Itz-fork/py-trans.git
```## Usage
```py
# Sync version
from py_trans import PyTranslator# Async version
from py_trans import Async_PyTranslator
```- Detect language of the provided text
- `detect`
-
```py
tr.detect("Hello!")
```
- Translate text using Google translate
- `google`
-
```py
tr.google("Hello!", "es")
```
- Translate text using Translate.com
- `translate_com`
-
```py
tr.translate_com("Hello!", "es")
```
- Translate text using My Memory
- `my_memory`
-
```py
tr.my_memory("Hello!", "es")
```
- Translate text using Translate dict
- `translate_dict`
-
```py
tr.translate_dict("Hello!", "es")
```
- Get language code/name
-
```py
# 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`)## License
- Copyright (C) 2023 [@Itz-fork](https://github.com/Itz-fork)
- Licensed under [MIT](/LICENSE)