Easy Google Translate: Unofficial Google Translate API
Project description
easygoogletranslate
Unofficial Google Translate API.
This library does not need an api key or something else to use, it's free and simple. You can either use a string or a file to translate but the text must be equal to or less than 5000 character. You can split your text into 5000 characters to translate more.
Google Translate supports 108 different languages. You can use any of them as source and target language in this application. If source language is not specified, it will detect source language automatically. This application supports multi thread translation, you can use it to translate multiple languages at once. Detailed language list can be found here: https://cloud.google.com/translate/docs/languages
Installation:
The easiest way to install easygoogletranslateis to download it from PyPI. Then you will be able to use the library.
pip install easygoogletranslate
Examples:
- Specify default source and target language at beginning and use it any time.
from easygoogletranslate import EasyGoogleTranslate
translator = EasyGoogleTranslate(
source_language='en',
target_language='de',
timeout=10
)
result = translator.translate('This is an example.')
print(result)
# Output: Dies ist ein Beispiel.
- Don't specify default parameters.
from easygoogletranslate import EasyGoogleTranslate
translator = EasyGoogleTranslate()
result = translator.translate('This is an example.', target_language='tr')
print(result)
# Output: Bu bir örnektir.
- Override default parameters.
from easygoogletranslate import EasyGoogleTranslate
translator = EasyGoogleTranslate(target_language='tr')
result = translator.translate('This is an example.', target_language='fr')
print(result)
# Output: Ceci est un exemple.
- Translate a text in multiple languages at once via multi-threading.
from easygoogletranslate import EasyGoogleTranslate
translator = EasyGoogleTranslate()
result = translator.translate(text='This is an example.', target_language=['tr', 'fr', 'de'])
print(result)
# Output: ['Bu bir örnektir.', 'Ceci est un exemple.', 'Dies ist ein Beispiel.']
- Translate a file in multiple languages at once via multi-threading.
from easygoogletranslate import EasyGoogleTranslate
translator = EasyGoogleTranslate()
result = translator.translate_file(file_path='text.txt', target_language=['tr', 'fr', 'de'])
print(result)
# Output: ['Nasılsın?', 'Comment ca va?', 'Wie geht es Ihnen?']
# Text inside file: How are you?
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
Built Distribution
File details
Details for the file easygoogletranslate-0.0.4.tar.gz
.
File metadata
- Download URL: easygoogletranslate-0.0.4.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c906e3d055aec0b1892ef47f52cc6b345bf23c9add1cbf47a29229dcfcd7aa06 |
|
MD5 | 99f8799d1f416d59a8960e55e1ba7535 |
|
BLAKE2b-256 | 25005b1b9049aa320c0fe2529dc1f8f9df01af78a91667fec51521e9464754f2 |
File details
Details for the file easygoogletranslate-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: easygoogletranslate-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7fb9f1529bbef83e80c770d0f813e99f485d6f1f32870dd53b6d0f2455c15bc |
|
MD5 | f90dd3190b3d8f9a9c1c3e68358378fa |
|
BLAKE2b-256 | bd87f80c32aa6afa4ccc0d88b540cad783f274b0a5a034fddb14987f030628c2 |