A Python3 library for translating text using Google Translate API.
Project description
gpytranslate
A Python3 library for translating text using Google Translate API.
Features
- Both Synchronous and Asynchronous
- Dot accessible values
- Supports emoji
- Type hinted
- Free to use
- Easy
Quick Start
Installation
Requirements:
- Python 3.6 or higher.
$ python3 -m pip install -U gpytranslate
Usage
from gpytranslate import Translator
import asyncio
async def main():
t = Translator()
translation = await t.translate("Ciao come stai? Io bene ahah.", targetlang="en")
language = await t.detect(translation.text)
print(f"Translation: {translation.text}\nDetected language: {language}")
if __name__ == "__main__":
asyncio.run(main())
from gpytranslate import SyncTranslator
t = SyncTranslator()
translation = t.translate("Ciao come stai? Io bene ahah.", targetlang="en")
language = t.detect(translation.text)
print(f"Translation: {translation.text}\nDetected language: {language}")
❓ Note: you could also check tests folder for extra examples.
Output:
Translation: Hello how are you? I'm fine, haha.
Detected language: it
Development
Want to contribute? Pull requests are accepted!
License
Licensed under the GNU GPLv3.
Click here for futher information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gpytranslate-1.1.0.tar.gz
(16.8 kB
view details)
Built Distribution
File details
Details for the file gpytranslate-1.1.0.tar.gz
.
File metadata
- Download URL: gpytranslate-1.1.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44f40555e3e4193894a4e2cad88d08168e1f82f8ac83fae21995f1204cdf7719 |
|
MD5 | 3a840e82bb982a5159a5294ce4a889ae |
|
BLAKE2b-256 | dee87ce7b3ccbd38ebb4debe66a363f29fb79a3aea37bfaeb84cc2dbb4969993 |
File details
Details for the file gpytranslate-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: gpytranslate-1.1.0-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 037834f73bcd628e3035d163869d3b411ab8ba437c4cc0ef2cfef3cd4c7b11da |
|
MD5 | 06b442fee67292962ec3791489d6805b |
|
BLAKE2b-256 | a98490c543f126c72381f40ea3cd90228b05567770a07d3adc97a4192675235d |