-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
118 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,50 @@ | ||
<h1 align="center">Mintrans is a free API wrapper that utilizes Bing Translator for translation purposes.</h1> | ||
# 🗺️ mintrans - A translation API wrapper 🗺️ | ||
|
||
<br> | ||
mintrans is a free API wrapper that utilizes Bing, DeepL, and Google Translate for translation purposes. 🤖 | ||
|
||
<h1 align="center"> -How to use- </h1> | ||
## 💡 How to use 💡 | ||
|
||
```python | ||
from mintrans import BingTranslator | ||
```python | ||
from mintrans import BingTranslator, DeepLTranslator, GoogleTranslator | ||
from mintrans import RateLimitException | ||
|
||
text = 'Hello World!' | ||
from_lang = 'en' | ||
to_lang = 'de' | ||
from_lang = 'en' | ||
to_lang = 'fr' | ||
|
||
# Bing Translator | ||
bing_translator = BingTranslator() | ||
bing_translation = bing_translator.translate(text, from_lang, to_lang) | ||
print(bing_translation) | ||
|
||
# DeepL Translator | ||
deepl_translator = DeepLTranslator() | ||
try: | ||
deepl_translation = deepl_translator.translate(text, from_lang, to_lang) | ||
print(deepl_translation) | ||
except RateLimitException: | ||
print('Limit of DeepL Translator reached!') | ||
|
||
# Google Translator | ||
google_translator = GoogleTranslator() | ||
google_translation = google_translator.translate(text, from_lang, to_lang) | ||
print(google_translation) | ||
``` | ||
|
||
## 🔑 Features 🔑 | ||
|
||
- Bing, DeepL and Google translators for more translation options! | ||
- Easy switching between translators. | ||
- Supports 100+ languages across translators. 🌍 | ||
|
||
## 🏆 Examples 🏆 | ||
|
||
```python | ||
text = 'This is a longer text to test the translation.' | ||
|
||
bing_translation = bing_translator.translate(text, 'en', 'es') | ||
|
||
deepl_translation = deepl_translator.translate(text, 'en', 'de') | ||
|
||
translator = BingTranslator() | ||
translation = translator.translate(text, from_lang, to_lang) | ||
print(translation) | ||
google_translation = google_translator.translate(text, 'en', 'fr') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .mintrans import BingTranslator | ||
from .mintrans import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters