# py-trans
```py
from py_trans import PyTranslator
tr = PyTranslator()
print(tr.google("Hi", "es"))
```
<p align="center">
A Fast, hassle-free way to translate text 📖
<p>
<p align="center">
<kbd><a href="#features"><b>Features</b></a></kbd>
<kbd><a href="#installation"><b>Install</b></a></kbd>
<kbd><a href="#usage"><b>Usage</b></a></kbd>
</p>
## 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
```
<details>
<summary><b>Install from source</b></summary>
```sh
pip install git+https://github.com/Itz-fork/py-trans.git
```
</details>
## 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)
Raw data
{
"_id": null,
"home_page": "https://github.com/Itz-fork/py-trans",
"name": "py-trans",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "google translate,text translator,translator,py-trans",
"author": "Itz-fork",
"author_email": "git.itzfork@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/72/48/eb302dc35e1695d9eded00e270d4419a2d82f2740413943ed5ecc931ca14/py-trans-0.6.1.tar.gz",
"platform": null,
"description": "# py-trans\n```py\nfrom py_trans import PyTranslator\n\ntr = PyTranslator()\nprint(tr.google(\"Hi\", \"es\"))\n```\n\n<p align=\"center\">\n A Fast, hassle-free way to translate text \ud83d\udcd6\n<p>\n\n<p align=\"center\">\n <kbd><a href=\"#features\"><b>Features</b></a></kbd>\n <kbd><a href=\"#installation\"><b>Install</b></a></kbd>\n <kbd><a href=\"#usage\"><b>Usage</b></a></kbd>\n</p>\n\n\n## Features\n- Simple and free\n- Multiple translators to choose\n- Both synchronous & asynchronous versions\n\n\n## Supported translators\n| Engine | Function |\n| ------------------------------------------------ | --------------- |\n|[Google Translate](https://translate.google.com/) | `google` |\n|[translate.com](https://www.translate.com/) | `translate_com` |\n|[MyMemory](https://mymemory.translated.net/) | `my_memory` |\n|[Translate Dict](https://www.translatedict.com/) | `translate_dict` |\n\n\n## Installation\n\n```sh\npip3 install py-trans\n```\n\n<details>\n <summary><b>Install from source</b></summary>\n\n ```sh\n pip install git+https://github.com/Itz-fork/py-trans.git\n ```\n</details>\n\n\n## Usage\n\n```py\n# Sync version\nfrom py_trans import PyTranslator\n\n# Async version\nfrom py_trans import Async_PyTranslator\n```\n\n- Detect language of the provided text\n - `detect`\n - \n ```py\n tr.detect(\"Hello!\")\n ```\n- Translate text using Google translate\n - `google`\n - \n ```py\n tr.google(\"Hello!\", \"es\")\n ```\n- Translate text using Translate.com\n - `translate_com`\n - \n ```py\n tr.translate_com(\"Hello!\", \"es\")\n ```\n- Translate text using My Memory\n - `my_memory`\n - \n ```py\n tr.my_memory(\"Hello!\", \"es\")\n ```\n- Translate text using Translate dict\n - `translate_dict`\n - \n ```py\n tr.translate_dict(\"Hello!\", \"es\")\n ```\n- Get language code/name\n - \n ```py\n # Sync version\n tr.get_lang_code(\"arabic\")\n tr.get_lang_name(\"ar\")\n\n # Async version\n tr.get_lang_code_async(\"arabic\")\n tr.get_lang_name_async(\"ar\")\n ```\n\n> [!NOTE]\n> All the above examples also applies to async version (`Async_PyTranslator`)\n\n\n## License\n- Copyright (C) 2023 [@Itz-fork](https://github.com/Itz-fork)\n- Licensed under [MIT](/LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Free python library to translate text to different languages.",
"version": "0.6.1",
"project_urls": {
"Download": "https://github.com/Itz-fork/py-trans/releases/tag/py-trans-pypi-v0.6.1",
"Homepage": "https://github.com/Itz-fork/py-trans"
},
"split_keywords": [
"google translate",
"text translator",
"translator",
"py-trans"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f2b50a2e7fd5a2f6db3f882b7524b63f3b9c71cf8248f55abeb1064994693912",
"md5": "30b896e3816207b44e80806fe037e2b1",
"sha256": "5441206dfcbce16e6407e8959432061583e466e9b5ba94a174fac9449a61c7d5"
},
"downloads": -1,
"filename": "py_trans-0.6.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "30b896e3816207b44e80806fe037e2b1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8939,
"upload_time": "2023-11-13T02:46:32",
"upload_time_iso_8601": "2023-11-13T02:46:32.237218Z",
"url": "https://files.pythonhosted.org/packages/f2/b5/0a2e7fd5a2f6db3f882b7524b63f3b9c71cf8248f55abeb1064994693912/py_trans-0.6.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7248eb302dc35e1695d9eded00e270d4419a2d82f2740413943ed5ecc931ca14",
"md5": "c55e526d9c76e7f8ade65d212fe6dc9d",
"sha256": "9f049db5b6f3676a4917bf60804716b3bb52457b907994e142c2893f150b8c60"
},
"downloads": -1,
"filename": "py-trans-0.6.1.tar.gz",
"has_sig": false,
"md5_digest": "c55e526d9c76e7f8ade65d212fe6dc9d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8337,
"upload_time": "2023-11-13T02:46:35",
"upload_time_iso_8601": "2023-11-13T02:46:35.672314Z",
"url": "https://files.pythonhosted.org/packages/72/48/eb302dc35e1695d9eded00e270d4419a2d82f2740413943ed5ecc931ca14/py-trans-0.6.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-13 02:46:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Itz-fork",
"github_project": "py-trans",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "py-trans"
}