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 hashes)
Built Distribution
Close
Hashes for gpytranslate-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 037834f73bcd628e3035d163869d3b411ab8ba437c4cc0ef2cfef3cd4c7b11da |
|
MD5 | 06b442fee67292962ec3791489d6805b |
|
BLAKE2b-256 | a98490c543f126c72381f40ea3cd90228b05567770a07d3adc97a4192675235d |