A module grouping multiple translation APIs

Overview

translatepy (originally: translate)

An aggregation of multiple translation API

Translate, transliterate, get the language of texts in no time with the help of multiple APIs!

PyPI version Downloads PyPI - Downloads PyPI - Python Version PyPI - Status GitHub - License GitHub top language CodeQL Checks Badge Pytest Code Size Repo Size Issues

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

You will need Python 3 to use this module

# vermin output
Minimum required versions: 3.2
Incompatible versions:     2

According to Vermin (--backport typing), Python 3.2 is needed for the backport of typing but some may say that it is available for python versions higher than 3.0

Always check if your Python version works with translatepy before using it in production

Installing

Option 1: From PyPI

pip install --upgrade translatepy

Option 2: From Git

pip install --upgrade git+https://github.com/Animenosekai/translate

You can check if you successfully installed it by printing out its version:

$ translatepy --version
# output:
translatepy v2.2

or just:

$ python -c "import translatepy; print(translatepy.__version__)"
# output:
translatepy v2.2

List of Built-in Services

... but plugins can be made and/or used. More on that in the plugins section.

All of the names belong to their respective rightholders.

Usage

Command line interface mode

Interactive Shell (REPL)

$ translatepy shell
## Choose the action
[?] What do you want to do?: Translate
 > Translate
   Transliterate
   Spellcheck
   Language
   Example
   Quit

## Choose the language to translate in (this step can be skipped by passing the `--dest-lang` argument when starting the program)
In what language do you want to translate in?
[?] (translatepy ~ Select Lang.) > : ...

## Translate
Enter '.quit' to stop translating
(translatepy ~ Translate) > ... # type in whatever you want to translate

In other applications/from the terminal

Select an action: {translate,transliterate,language,spellcheck}

and pass it as a command with the right arguments:

$ translatepy translate --dest-lang Français --text Hello
{
    "success": true,
    "service": "Google",
    "source": "Hello",
    "sourceLanguage": "eng",
    "destinationLanguage": "fra",
    "result": "Bonjour"
}

In Python script

The Translator Class

The translator lets you group and use multiple translators at the same time, to increase your chance on getting an answer.

It takes two optional arguments: the services_list argument, which is a list of Translator objects and the second one being the request argument which is the object which will be used to make requests.

It has all of the supported methods.

  • translate: To translate things
  • translate_html : To translate HTML snippets
  • transliterate: To transliterate things
  • spellcheck: To check the spelling of a text
  • language: To get the language of a text
  • example: To get a list of examples of a word
  • dictionary: To get a list of translations categorized into "featured" and "less common" by DeepL and Linguee
  • text_to_speech: To get an audio file containing the speech version of the given text

When something goes wrong or nothing got found, an exception will be raised. (this is in bold because it is one of the difference that comes with v2)

>> translator.language("こんにちは") LanguageResult(service=Yandex, source=こんにちは, result=Language(jpn))">
>>> from translatepy import Translator
>>> translator = Translator()
>>> translator.translate("Hello", "French")
TranslationResult(service=Yandex, source=Hello, source_language=auto, destination_language=French, result=Bonjour)
>>> translator.language("こんにちは")
LanguageResult(service=Yandex, source=こんにちは, result=Language(jpn))

Translators

You can use each translators separately by using them the same way as you would with translatepy.Translator (or translatepy.Translate)

>>> from translatepy.translators.google import GoogleTranslate
>>> gtranslate = GoogleTranslate()
>>> gtranslate.translate("Hello World", "Japanese")
TranslationResult(service=Google, source=Hello World, source_language=eng, destination_language=jpn, result=こんにちは世界)

And some translators have their own parameters:

>> gtranslate_china.translate("Hello World", "Japanese") TranslationResult(service=Google, source=Hello World, source_language=eng, destination_language=jpn, result=こんにちは世界) # it can even be used by translatepy.Translator >>> from translatepy import Translator >>> t = Translator([gtranslate_china]) >>> t.translate("Hello World", "Japanese") TranslationResult(service=Google, source=Hello World, source_language=eng, destination_language=jpn, result=こんにちは世界)">
>>> gtranslate_china = GoogleTranslate(service_url="translate.google.cn")
>>> gtranslate_china.translate("Hello World", "Japanese")
TranslationResult(service=Google, source=Hello World, source_language=eng, destination_language=jpn, result=こんにちは世界)

# it can even be used by translatepy.Translator
>>> from translatepy import Translator
>>> t = Translator([gtranslate_china])
>>> t.translate("Hello World", "Japanese")
TranslationResult(service=Google, source=Hello World, source_language=eng, destination_language=jpn, result=こんにちは世界)

The Language Class

The language class contains lots of information about a language.

You need to pass the language name or code to the class initialization:

>> Language("en") # Returns a Language class with the "eng" language >>> Language("eng") # Returns a Language class with the "eng" language >>> Language("日本語") # Returns a Language class with the "jpn" language">
>>> from translatepy import Language
>>> Language("French")
# Returns a Language class with the "fra" language
>>> Language("en")
# Returns a Language class with the "eng" language
>>> Language("eng")
# Returns a Language class with the "eng" language
>>> Language("日本語")
# Returns a Language class with the "jpn" language

The Language Class contains both the ISO 639-1 Alpha-2 language code and the ISO 639-2 Alpha-3 language code.

>> Language("English").alpha3 # ISO 639-3 (alpha 3) 'eng' >>> Language("English").alpha3b # ISO 639-2B, nullable 'eng' >>> Language("English").alpha3t # ISO 639-2T, nullable 'eng'">
>>> Language("English").alpha2 # ISO 639-1 (alpha 2), nullable
'en'
>>> Language("English").alpha3 # ISO 639-3 (alpha 3)
'eng'
>>> Language("English").alpha3b # ISO 639-2B, nullable
'eng'
>>> Language("English").alpha3t # ISO 639-2T, nullable
'eng'

Each available language has its own ID, coming from the Alpha-3 Language Code most of the times (but which is also unique for languages such as the "Automatic" Language and the "Emoji" one)

>> Language("Emoji").id 'emj' >>> Language("Automatic").id 'auto'">
>>> Language("French").id
'fra'
>>> Language("Emoji").id
'emj'
>>> Language("Automatic").id
'auto'

It also contains the language name for a lot of languages:

>>> Language("Français").in_foreign_languages.get("ja", None) # an alpha-2 code needs to be passed in, also make sure to have a fallback such as None here because not all of the languages had been translated.
'フランス語'

All of the languages which have an alpha2 code are assured to have at least their translation in all of the following languages:

to = ['af', 'am', 'ar', 'az', 'be', 'bg', 'bn', 'bs', 'ca', 'ceb', 'co', 'cs', 'cy', 'da', 'de', 'el', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fr', 'fy', 'ga', 'gd', 'gl', 'gu', 'ha', 'haw', 'hi', 'hmn', 'hr', 'ht', 'hu', 'hy', 'id', 'ig', 'is', 'it', 'he', 'ja', 'jv', 'ka', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'la', 'lb', 'lo', 'lt', 'lv', 'mg', 'mi', 'mk', 'ml', 'mn', 'mr', 'ms', 'mt', 'my', 'ne', 'nl', 'no', 'ny', 'or', 'pa', 'pl', 'ps', 'pt', 'ro', 'ru', 'sd', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sq', 'sr', 'st', 'su', 'sv', 'sw', 'ta', 'te', 'tg', 'th', 'tl', 'tr', 'ug', 'uk', 'ur', 'uz', 'vi', 'xh', 'yi', 'yo', 'zh', 'zu']

The other ones may or may not have a translation in more or less languages.

The Language class also contains the "similarity" attribute which gives back a number between 0 and 100 which shows the similarity of the input language with what it found in the language code database:

>> Language("Englesh").similarity 94.86832980505137">
>>> round(Language("French").similarity, 2)
100.0
>>> Language("Englesh").similarity
94.86832980505137
Note

Only the languages which have an alpha2 language code and are of type Living or Ancient are vectorized and will be used in the similarity search.


Each language also have 'extra' data: their type (nullable) and the scope (nullable).

>> Language("Latin").extra.type LanguageType(Ancient)">
>>> Language("French").extra
LanguageExtra(type=LanguageType(Living), scope=LanguageScope(Individual))
>>> Language("Latin").extra.type
LanguageType(Ancient)

A translatepy.exceptions.UnknownLanguage exception is raised if the given language is unknown.

This exception contains the most similar language along with its similarity:

>>> from translatepy import Language
>>> from translatepy.exceptions import UnknownLanguage
>>> try:
...     language = Language("中国")
... except UnknownLanguage as error:
...     print("The similarity seemed to be too low for translatepy to accept it as a correct language name")
...     print("The language found is:", error.guessed_language)
...     print("Its similarity from the passed input is:", str(error.similarity))

If you find that the default threshold given to the language search is too low, you can always change it by passing the threshold parameter when initializing a Language:

", line 1, in File "/Users/animenosekai/Documents/Coding/Projects/translate/translatepy/language.py", line 106, in __init__ raise UnknownLanguage(_search_result, self.similarity, raising_message) translatepy.exceptions.UnknownLanguage: Couldn't recognize the given language (中国) Did you mean: 中国語 (Similarity: 81.65%)? >>> Language("中国", threshold=80) Language(zho)">
>>> from translatepy import Language
>>> Language("国語")
Traceback (most recent call last):
  File "
    
     "
    , line 1, in <module>
  File "/Users/animenosekai/Documents/Coding/Projects/translate/translatepy/language.py", line 106, in __init__
    raise UnknownLanguage(_search_result, self.similarity, raising_message)
translatepy.exceptions.UnknownLanguage: Couldn't recognize the given language (中国)
Did you mean: 中国語 (Similarity: 81.65%)?
>>> Language("中国", threshold=80)
Language(zho)

Results

All of the methods should have its own result class (defined in translatepy/models.py) which all have at least the service, source, result attributes and a "as_json" method to convert everything into a JSON String.

Errors

All of the translatepy errors are inherited from translatepy.exceptions.TranslatepyException so that you can easily catch a translatepy error.

>>> from translatepy import Translator
>>> from translatepy.exceptions import TranslatepyException, UnknownLanguage
>>> t = Translator()
>>> def translate(text, dest):
...     try:
...         result = t.translate(text, destination_language=dest)
        except UnknownLanguage as err:
            print("An error occured while searching for the language you passed in")
            print("Similarity:", round(err.similarity), "%")
            return
        except TranslatepyException:
            print("An error occured while translating with translatepy")
            return
        except Exception:
            print("An unknown error occured")
            return
...     # do something with the result...
...     

Plugins

You can make your own Translator using the translatepy.translators.base.BaseTranslator class.

Make sure that you inherit from this class when creating your translator and to follow the instruction from plugin.md

Caching

All of the operations are cached to provide the best performances

You can empty the cache by calling the method "clean_cache"

Deployment

This module is currently in development and might contain bugs.

Feel free to use it in production if you feel like it is suitable for your production even if you may encounter issues.

Contributing

Pull requests are welcome. For major changes, please open an discussion first to discuss what you would like to change.

Please make sure to update the tests as appropriate.

Built With

Authors

Disclaimer

Please do not use this module in a commercial manner. Pay a proper API Key from one of the services to do so.

License

This project is licensed under the GNU Affero General Public License v3.0 License - see the LICENSE file for details

Dataset

The 'playground' folder contains a lot of our search and results for the language management on translatepy (this folder might be very messy because of all of our experiments in it)

The translatepy/utils/_language_cache.py file contains all of the data for the language searching used by translatepy

Please ask us if you want to use them in another project.

Most of the language data come from Google Translate, Yandex Translate and iso-639-3

Acknowledgments

  • Thanks to @spamz23 (Diogo Silva) for the development of the code refactoring used in v2 (tests and Translator) (check: spamz23/translate)
  • Thanks to @ZhymabekRoman (Zhymabek Roman) for working on making Yandex more stable and on the v2!
  • Inspired by py-googletrans (by @ssut) (especially the thread: Issue #268)
Comments
  • There seems to be an issue with the Yandex translation module

    There seems to be an issue with the Yandex translation module

    I acquired a key from Yandex per the documentation, and added it to the self._id in yandex.py. I then tried the following test:

    YandexTranslate().translate("Er ist klug.", 'en', source_language='de')

    And received this response:

    [2021-02-10 15:14:10] DEBUG [urllib3.connectionpool._new_conn:815] Starting new HTTPS connection (1): translate.yandex.com:443
    [2021-02-10 15:14:11] DEBUG [urllib3.connectionpool._make_request:396] https://translate.yandex.com:443 "GET / HTTP/1.1" 302 None
    [2021-02-10 15:14:11] DEBUG [urllib3.connectionpool._make_request:396] https://translate.yandex.com:443 "GET /showcaptcha?cc=1&retpath=https%3A//translate.yandex.com/%3F_d8b298bcbb08a8bc220250756257504f&t=0/1612995251/ed1baa2e6a042ec73b1baca9e7b53471&s=d8a68d97e1858e6fff641ad5605ad257 HTTP/1.1" 200 6231
    [2021-02-10 15:14:11] DEBUG [urllib3.connectionpool._new_conn:815] Starting new HTTPS connection (1): translate.yandex.net:443
    [2021-02-10 15:14:12] DEBUG [urllib3.connectionpool._make_request:396] https://translate.yandex.net:443 "GET /api/v1/tr.json/translate?id=1308a84a.6016deed.0c4881a2.74722d74657874-3-0&srv=tr-text&lang=en&reason=de&format=text HTTP/1.1" 403 44
    [2021-02-10 15:14:12] DEBUG [translation_services.yandex.translate:85] status_code=403, json_code=406
    

    When I googled for the error code from Yandex, I found this page: https://yandex.com/dev/translate/doc/dg/concepts/api-keys.html, which implies the free API was discontinued in May 2020 for non-residents of the Russian Federation.

    What am I doing wrong, or has the api been discontinued?

    Thanks!

    Mark

    enhancement 
    opened by pmi123 53
  • [add] translatepy v2.0

    [add] translatepy v2.0

    New features: - Exception raising - Proxy support (partly needs to be refined - WIP) - A better class management, with base classes - Full code refactoring - New Bing Translate implementation And more .....

    WIP*: - Fully implement text to spech function - Convert ISO 639 to CSV - Implement supported_languages method

    *WIP - working in process

    opened by ZhymabekRoman 17
  • Deepl does not seem to work

    Deepl does not seem to work

    Or at least does not work from my location.

    from translatepy.translators.deepl import DeepL
    dl = DeepL()
    dl.translate("test this", 'de', 'en')
    # -> {"jsonrpc": "2.0","error":{"code":1042912,"message":"Too many requests."}}
    

    pyppeteer is probably the only way to scrape deepl, but pyppeteer is quite slow.

    opened by yucongo 16
  • Consider adding DeepL.

    Consider adding DeepL.

    This "issue" is a work-in-progress; feel free to contribute in the comments.

    Strangely enough, I found this translation engine while watching a vTuber. This website is pretty complex, so strap in.

    Wikipedia: https://en.wikipedia.org/wiki/DeepL_Translator Translator: https://www.deepl.com/translator

    Supported Languages

    From

    [
      ["Any language (detect)", "auto"], // It seems that language detection is done through a JSON-RPC request unrelated to translating, so this is kinda pointless, but I won't remove it.
      ["Chinese", "zh"],
      ["Dutch", "nl"],
      ["English", "en"],
      ["French", "fr"],
      ["German", "de"],
      ["Italian", "it"],
      ["Japanese", "ja"],
      ["Polish", "pl"],
      ["Portuguese", "pt"],
      ["Russian", "ru"],
      ["Spanish", "es"]
    ]
    

    To

    [
      ["English (American)", "en-US"],
      ["English (British)", "en-GB"],
      ["Chinese (simplified)", "zh-ZH"],
      ["Dutch", "nl-NL"], // Formality support
      ["French", "fr-FR"], // Formality support
      ["German", "de-DE"], // Formality support
      ["Italian", "it-IT"], // Formality support
      ["Japanese", "ja-JA"],
      ["Polish", "pl-PL"],  // Formality support
      ["Portuguese", "pt-PT"], // Formality support
      ["Portuguese (Brazilian)", "pt-BR"], // Formality support
      ["Russian", "ru-RU"], // Formality support
      ["Spanish", "es-ES"] // Formality support
    ]
    

    Formality

    This is where it starts to get interesting! Some languages that you can translate to can have differing levels of formality. All languages that do support it are labeled above.

    [
      ["Formal tone", "formal"],
      ["Informal tone", "informal"],
      ["Automatic", "auto"]
    ]
    

    Translating

    This API seems to make use of JSON-RPC, which I'm not super familiar with, so assistance would be appreciated. URL: https://www2.deepl.com/jsonrpc HTTP Verb: POST

    Example Request/Response

    Here, we're translating hello in English to Japanese.

    Request Payload (JSON)

    {
      "jsonrpc": "2.0",
      "method": "LMT_handle_jobs",
      "params": {
        "jobs": [
          {
            "kind": "default",
            // Ignore use of en here, these same parameters are used for all languages
            "raw_en_sentence": "hello",
            "raw_en_context_before": [],
            "raw_en_context_after": [],
            "preferred_num_beams": 4
          }
        ],
        "lang": {
          "user_preferred_langs": [
            "NL",
            "DE",
            "IT",
            "PL",
            "PT",
            "RU",
            "ES",
            "ZH",
            "FR",
            "JA",
            "EN"
          ],
          // To and from
          "source_lang_computed": "EN",
          "target_lang": "JA"
        },
        "priority": 1,
        "commonJobParams": {},
        "timestamp": 1613084905408
      },
      // No idea what this means; random number?
      "id": 52850007
    }
    

    Response

    {
      "jsonrpc": "2.0",
      "id": 52850007,
      "result": {
        "translations": [
          {
            "beams": [
              // Recommended translation
              {
                "postprocessed_sentence": "こんにちわ",
                "num_symbols": 6
              },
              // Alternatives
              {
                "postprocessed_sentence": "こんにちは",
                "num_symbols": 3
              },
              {
                "postprocessed_sentence": "ハロー",
                "num_symbols": 3
              },
              {
                "postprocessed_sentence": "もしもし",
                "num_symbols": 3
              }
            ],
            "quality": "normal"
          }
        ],
        "target_lang": "JA",
        "source_lang": "EN",
        "source_lang_is_confident": false,
        "detectedLanguages": {},
        "timestamp": 1613084907,
        "date": "20210211"
      }
    }
    

    Dictionary

    Alongside translation, we also have access to a dictionary sent via an HTML fragment.

    Example Request/Response

    URL: https://dict.deepl.com/english-japanese/search?ajax=1&source=english&onlyDictEntries=1&translator=dnsof7h3k2lgh3gda&delay=300&jsStatus=0&kind=full&eventkind=langChange&forleftside=true HTTP Verb: POST

    Request Body (Form Data)

    query=hello
    

    Response

    <div id='data' data-numberQueriesSoFar='0' data-lingueeEncoding='utf-8' data-sourceIsLang1='0' data-lang1='JA' data-lang2='EN' data-mainFlag='us' data-baseURL='/english-japanese' data-query='hello' data-correctSpellingOfQuery='hello' data-numberPhrases='0' data-numberSentences='0' data-sourceLang='EN' data-sourceFlag='us' data-targetLang='JA'></div>
    <div class='innercontent'>
        <div id='dictionary'>
            <h1 class='dict_headline_for_0 bothsides wide_in_main'>
                <div class='openTriangle'> &#9662;</div>Dictionary English-Japanese</h1>
            <div class='isMainTerm' data-source-lang='EN'>
                <div class='exact'>
                    <div class='lemma featured' wt='0'>
                        <div>
                            <h2 class='line lemma_desc' lid='EN:hello15448'><span class='tag_lemma'><a class='dictLink' rel='nofollow' href='/english-japanese/translation/hello.html'>hello</a> <a id='EN_US/5d/5d41402abc4b2a76b9719d911017c592-0' class='audio' onclick='playSound(this,"EN_US/5d/5d41402abc4b2a76b9719d911017c592-0","American English","EN_UK/5d/5d41402abc4b2a76b9719d911017c592-0","British English");'></a></span><span class='dash'>&mdash;</span></h2>
                            <div class='lemma_content'>
                                <div class='meaninggroup  sortablemg' gid='0'>
                                    <div class='translation_lines'>
                                        <div class='translation sortablemg featured'>
                                            <h3 class='translation_desc'><span class='tag_trans' bid='10001294287' lid='JA:#########57716'><a id='dictEntry10001294287' href='/japanese-english/translation/%E3%83%8F%E3%83%AD%E3%83%BC.html' class='dictLink featured'>ハロー</a><a class='expand_i'></a></span>
                                                <!--tag_trans-->
                                            </h3>
                                            <!--translation_desc-->
                                            <!-- editorial isFeatured 1 inType 0 allowFeatured 1 available: 0 -->
                                        </div>
                                        <div class='translation sortablemg featured'>
                                            <h3 class='translation_desc'><span class='tag_trans' bid='10001347706' lid='JA:###############53649'><a id='dictEntry10001347706' href='/japanese-english/translation/%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF.html' class='dictLink featured'>こんにちは</a><a class='expand_i'></a></span>
                                                <!--tag_trans-->
                                            </h3>
                                            <!--translation_desc-->
                                            <!-- editorial isFeatured 1 inType 0 allowFeatured 1 available: 0 -->
                                        </div>
                                        <div class='translation_group'>
                                            <div class='line group_line translation_group_line'><span class='notascommon'>less common:</span>
                                                <div class='translation sortablemg translation_first'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001209742' lid='JA:#########20937'><a id='dictEntry10001209742' href='/japanese-english/translation/%E4%BB%8A%E6%97%A5%E3%81%AF.html' class='dictLink'>今日は</a><a class='expand_i'></a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001478146' lid='JA:#########18286'><a id='dictEntry10001478146' href='/japanese-english/translation/%E3%81%A9%E3%81%86%E3%82%82.html' class='dictLink'>どうも</a><a class='expand_i'></a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001347751' lid='JA:###############58474'><a id='dictEntry10001347751' href='/japanese-english/translation/%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%82%8F.html' class='dictLink'>こんにちわ</a><a class='expand_i'></a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001241561' lid='JA:############4113'><a id='dictEntry10001241561' href='/japanese-english/translation/%E3%81%93%E3%81%AB%E3%81%A1%E3%81%AF.html' class='dictLink'>こにちは</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001292425' lid='JA:############49954'><a id='dictEntry10001292425' href='/japanese-english/translation/%E3%81%BB%E3%81%84%E3%81%BB%E3%81%84.html' class='dictLink'>ほいほい</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001528104' lid='JA:#########31519'><a id='dictEntry10001528104' href='/japanese-english/translation/%E3%81%8A%E3%83%BC%E3%81%84.html' class='dictLink'>おーい</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001281333' lid='JA:########################9421'><a id='dictEntry10001281333' href='/japanese-english/translation/%E3%82%A2%E3%83%B3%E3%83%8B%E3%83%A7%E3%83%B3%E3%83%8F%E3%82%BB%E3%83%A8.html' class='dictLink'>アンニョンハセヨ</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001371063' lid='JA:##################25995'><a id='dictEntry10001371063' href='/japanese-english/translation/%E3%82%A2%E3%83%8B%E3%83%A7%E3%83%8F%E3%82%BB%E3%83%A8.html' class='dictLink'>アニョハセヨ</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001346566' lid='JA:############55814'><a id='dictEntry10001346566' href='/japanese-english/translation/%E3%81%93%E3%82%93%E3%81%A1%E3%81%AF.html' class='dictLink'>こんちは</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001320067' lid='JA:############36110'><a id='dictEntry10001320067' href='/japanese-english/translation/%E3%83%8F%E3%82%A4%E3%82%B5%E3%82%A4.html' class='dictLink'>ハイサイ</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001241611' lid='JA:############34605'><a id='dictEntry10001241611' href='/japanese-english/translation/%E3%81%93%E3%81%AB%E3%81%A1%E3%82%8F.html' class='dictLink'>こにちわ</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001336747' lid='JA:############24625'><a id='dictEntry10001336747' href='/japanese-english/translation/%E3%83%8B%E3%83%BC%E3%83%8F%E3%82%AA.html' class='dictLink'>ニーハオ</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001295187' lid='JA:######56948'><a id='dictEntry10001295187' href='/japanese-english/translation/%E3%83%8F%E3%83%AD.html' class='dictLink'>ハロ</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                    <span class='sep'>&middot;</span> </div>
                                                <div class='translation sortablemg'>
                                                    <div class='translation_desc'><span class='tag_trans' bid='10001214671' lid='JA:############61778'><a id='dictEntry10001214671' href='/japanese-english/translation/%E3%83%9B%E3%82%A4%E3%83%9B%E3%82%A4.html' class='dictLink'>ホイホイ</a></span>
                                                        <!--tag_trans-->
                                                    </div>
                                                    <!--translation_desc-->
                                                    <!-- editorial isFeatured 0 inType 0 allowFeatured 1 available: 0 -->
                                                </div>
                                            </div>
                                        </div>
    
                                    </div>
                                    <!--translation_lines-->
                                </div>
                                <!--meaninggroup-->
                            </div>
                            <!--lemma_content-->
                        </div>
                    </div>
                    <!--lemma-->
                </div>
                <!--exact-->
                <div class='copyrightLineOuter'>
                    <div class='copyrightLine'>&copy; Linguee Dictionary, 2020</div>
                </div>
            </div>
        </div>
        <!--dictionary-->
    </div>
    <!--innercontent-->
    <!-- 2021-Feb-11 23:21:03 -->
    
    enhancement 
    opened by SuperSonicHub1 14
  • ServiceConnectionError Exception

    ServiceConnectionError Exception

    Hi guys!

    First of all, awesome project, many thanks for it!

    Now to my issue: I can not figure out a proper way of checking whether service_url is reachable by translatepy or not (some kind of ServiceConnectionError Exception).

    If i just use this code when I'm offline:

    from translatepy.translators.google import GoogleTranslate
    
    server_url = 'translate.google.com'
    
    translator = GoogleTranslate(service_url=server_url)
    translator.translate('Текст 15', 'en').result
    
    

    I get error:

    translatepy\translators\base.py", line 110, in translate
        source_language, translation = self._translate(text, dest_code, source_code)
    TypeError: cannot unpack non-iterable NoneType object
    

    Which is not a clear reason of the translation failure.

    I tried to check it myself prior to translation using requests:

    import requests
    from translatepy.translators.google import GoogleTranslate
    
    
    def is_online(url):
        try:
            response = requests.head(url)
        except Exception as e:
            return f'{url} not reachable: {str(e)}'
        else:
            stat_code = response.status_code
            if stat_code == 200:
                return True
            else:
                return f'{url} not online. HTTP response code: {stat_code}'
    
    
    server_url = 'translate.google.com'
    
    print(is_online(f'https://{server_url}'))
    
    translator = GoogleTranslate(service_url=server_url)
    translator.clean_cache()
    translator.translate('Текст 16', 'en').result
    

    But it confuses me even more, as sometimes it gives opposite results. Like, url is not reachable but translation is ok (or vice versa):

    https://translate.google.com not reachable: HTTPSConnectionPool(host='translate.google.com', port=443): Max retries exceeded with url: / (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001D488901930>, 'Connection to translate.google.com timed out. (connect timeout=None)'))
    'Text 16'
    

    This happens when I'm turning on/off VPN instead of shutting down the network.

    What I need is a clear error that service's url could not be reached by translatepy. Any suggestions on this issue?

    Thanks in advance!

    opened by nodatasheet 12
  • BingTranslate.text_to_speech is not working

    BingTranslate.text_to_speech is not working

    In translatepy 2.0:

    from translatepy.translators.bing import BingTranslate
    t = BingTranslate()
    r = t.text_to_speech("こんにちは")
    print(r)
    
    Traceback (most recent call last):
      File "<stdin>", line 3, in <module>
      File "/home/eggplants/prog/translate/translatepy/translators/base.py", line 442, in text_to_speech
        source_language, text_to_speech = self._text_to_speech(text, speed, gender, source_code)
      File "/home/eggplants/prog/translate/translatepy/translators/bing.py", line 196, in _text_to_speech
        source_language = self._language(text)
      File "/home/eggplants/prog/translate/translatepy/translators/bing.py", line 165, in _language
        response = self.session_manager.send("https://www.bing.com/ttranslatev3", data={'text': text, 'fromLang': "auto-detect", 'to': "en"})
      File "/home/eggplants/prog/translate/translatepy/translators/bing.py", line 123, in send
        raise BingTranslateException(status_code)
    translatepy.translators.bing.BingTranslateException: 400 | Unknown error. Error code: 400
    
    400 | Unknown error. Error code: 400
    
    opened by eggplants 11
  • Bing & Deepl translators seem to be unable to get the correct JSON

    Bing & Deepl translators seem to be unable to get the correct JSON

    Hi all, I had tried to use the bing\deepl\google service, and only the google service can get the result, however the result text doesn't match the website shows... :( Test code like this:

    #from translatepy.translators.deepl import DeeplTranslate
    from translatepy.translators.bing import BingTranslate
    #from translatepy.translators.google import GoogleTranslate
    
    #GoogleTranslate().translate('测试用例','en')
    BingTranslate().translate('测试用例','en')
    #DeeplTranslate().translate('测试用例','en')
    

    And bing and deepl returned the same JSON error like this:

    JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    

    It seems pointing the requests post isn't working correctly...?

    opened by Arludesi 10
  • Possible to specify translate.google.cn?

    Possible to specify translate.google.cn?

    Hi. Thanks for the nice work.

    I did some tests with translatepy with google (google_tr = Translator(use_google=True, use_yandex=False, use_bing=False, use_reverso=False, use_deepl=False).translate). It worked great.

    However for users in some region that cannot access translate.google.com, they wont be able to use google in translatepy.

    In googletrans you can do something like from googletrans import Translator; translator = Translator(service_urls=['translate.google.com', 'translate.google.co.kr',]). Is this possible with translatepy?

    Thanks a lot.

    opened by yucongo 10
  • NoResult: No service has returned a valid result

    NoResult: No service has returned a valid result

    Hello,

    Get "No service has returned a valid result" from time to time. Sometimes it can be fixed by explicitly specifying the languages in "translate", but sometimes it just doesn't. It refuses to translate specific columns from a data frame while works well with others.

    NoResult                                  Traceback (most recent call last)
    Input In [14], in <cell line: 3>()
          1 #protest translator
          2 #df['Title EN'] = df['Titlle'].apply(str).apply(lambda x: translator.translate(x, 'en', 'ru'))
    ----> 3 df['short_description EN'] = df['short_description'].apply(str).apply(lambda x: translator.translate(x, 'en', 'ru'))
    
    File /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/series.py:4138, in Series.apply(self, func, convert_dtype, args, **kwds)
       4136     else:
       4137         values = self.astype(object)._values
    -> 4138         mapped = lib.map_infer(values, f, convert=convert_dtype)
       4140 if len(mapped) and isinstance(mapped[0], Series):
       4141     # GH 25959 use pd.array instead of tolist
       4142     # so extension arrays can be used
       4143     return self._constructor_expanddim(pd_array(mapped), index=self.index)
    
    File pandas/_libs/lib.pyx:2467, in pandas._libs.lib.map_infer()
    
    Input In [14], in <lambda>(x)
          1 #protest translator
          2 #df['Title EN'] = df['Title'].apply(str).apply(lambda x: translator.translate(x, 'en'))
    ----> 3 df['short_description EN'] = df['short_description'].apply(str).apply(lambda x: translator.translate(x, 'en', 'ru'))
    
    File /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/translatepy/translate.py:135, in Translate.translate(self, text, destination_language, source_language)
        133         continue
        134 else:
    --> 135     raise NoResult("No service has returned a valid result")
    
    NoResult: No service has returned a valid result
    

    Thanks

    opened by octner 8
  • Bing translator doesn't work

    Bing translator doesn't work

    >>> from translatepy.translators.bing import BingTranslate
    >>> dl = BingTranslate()
    >>> dl.translate("hello", "ru")
    Traceback (most recent call last):
      File "/home/ubuntu/translate/translatepy/translators/base.py", line 60, in translate
        translation = self._translate(text, dest_code, source_code)
      File "/home/ubuntu/translate/translatepy/translators/bing.py", line 84, in _translate
        return response[0]["translations"][0]["text"]
    KeyError: 0
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/ubuntu/translate/translatepy/translators/base.py", line 75, in translate
        raise TranslationError from exc
    translatepy.exceptions.TranslationError
    

    Server response: {'statusCode': 400}

    opened by ZhymabekRoman 8
  • Add supports for some language

    Add supports for some language

    For some languages, like Chinese, function _language_normalize() maybe result zh, zh-ch. this results are not in self._supported_languages, so, it cannnot work.

    I fixed some of it.

    opened by sunshineharry 7
  • Missing spaces between tags when using translate_html

    Missing spaces between tags when using translate_html

    Missing spaces between tags when using translate_html

    Code

    from translatepy import Translator
    print(Translator().translate_html("<p>I am a student and <strong>you are a teacher</strong></p>", "de"))
    

    Current:

    <p>Ich bin Student und<strong>du bist ein Lehrer</strong></p>
    

    Expected:

    <p>Ich bin Student und <strong>du bist ein Lehrer</strong></p>
    
    opened by thanhtoan1196 1
  • Bulk Translation support?

    Bulk Translation support?

    GoogleTrans supports bulk translation. image Can translatepy do the same? It could be improved from googletrans with parallelizing (googletrans does it sequentially I believe). Although implementing this outside the translatepy api is trivial, it would be nice and developer-friendly to allow this functionality by just passing a list to the translate method.

    enhancement 
    opened by emendoza2 1
  • Consider adding the formality and glossary feature to DeepL

    Consider adding the formality and glossary feature to DeepL

    At first sight, it seems that it is only a matter of adding some formated fields to the JSONRPC request:

    Capture d’écran 2022-07-21 172845

    For formality:

    • Options available: "formal", "informal", null
    • Even though it is a "premium" feature, DeepL returns the correct tone if entered (output obtained without the tone: "Vous êtes".): Capture d’écran 2022-07-21 174721

    For glossary (named dictionary in the json):

    • The only pairs in the glossary that are sent are those where the target text is in the target language that the user has chosen.
    • The glossary pairs are visibly sorted according to the order of the letters in the unicode table. (only the source text matters)
    • The same source text cannot have several translations (the previous pair is overwritten if this is the case)
    • A source text/target text pair is separated by '\t', two different pairs are separated by '\n'.
    • Backslash is escaped if used.

    Notes:

    • browserType is optional.
    • There must be another requirement to generate a correct glossary, because after some tests I get the error -32600 which corresponds to :Invalid Request 'Invalid commonJobParams'
    enhancement 
    opened by Profotaku 3
  • Bump itsdangerous from 2.0.1 to 2.1.2

    Bump itsdangerous from 2.0.1 to 2.1.2

    Bumps itsdangerous from 2.0.1 to 2.1.2.

    Release notes

    Sourced from itsdangerous's releases.

    2.1.2

    2.1.1

    2.1.0

    Changelog

    Sourced from itsdangerous's changelog.

    Version 2.1.2

    Released 2022-03-24

    • Handle date overflow in timed unsign on 32-bit systems. :pr:299

    Version 2.1.1

    Released 2022-03-09

    • Handle date overflow in timed unsign. :pr:296

    Version 2.1.0

    Released 2022-02-17

    • Drop support for Python 3.6. :pr:272

    • Remove previously deprecated code. :pr:273

      • JWS functionality: Use a dedicated library such as Authlib instead.
      • import itsdangerous.json: Import json from the standard library instead.
    Commits
    • 49d263f Merge pull request #301 from pallets/release-2.1.2
    • 8c75d07 release version 2.1.2
    • 64cd581 Merge pull request #299 from dirkmueller/main
    • 3edfbbb handle OverflowError in timed unsign on 32-bit systems
    • faa28bc start version 2.1.2
    • 38e9d8a Merge pull request #298 from pallets/release-2.1.1
    • ff13147 release version 2.1.1
    • 25494a8 Merge pull request #296 from alanhamlett/main
    • 177196d catch OSError on Windows
    • 37f0997 catching year overflow ValueError
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update jinja2 requirement from <3.1.0 to <3.2.0

    Update jinja2 requirement from <3.1.0 to <3.2.0

    Updates the requirements on jinja2 to permit the latest version.

    Release notes

    Sourced from jinja2's releases.

    3.1.2

    This is a fix release for the 3.1.0 feature release.

    Changelog

    Sourced from jinja2's changelog.

    Version 3.1.2

    Released 2022-04-28

    • Add parameters to Environment.overlay to match __init__. :issue:1645
    • Handle race condition in FileSystemBytecodeCache. :issue:1654

    Version 3.1.1

    Released 2022-03-25

    • The template filename on Windows uses the primary path separator. :issue:1637

    Version 3.1.0

    Released 2022-03-24

    • Drop support for Python 3.6. :pr:1534

    • Remove previously deprecated code. :pr:1544

      • WithExtension and AutoEscapeExtension are built-in now.
      • contextfilter and contextfunction are replaced by pass_context. evalcontextfilter and evalcontextfunction are replaced by pass_eval_context. environmentfilter and environmentfunction are replaced by pass_environment.
      • Markup and escape should be imported from MarkupSafe.
      • Compiled templates from very old Jinja versions may need to be recompiled.
      • Legacy resolve mode for Context subclasses is no longer supported. Override resolve_or_missing instead of resolve.
      • unicode_urlencode is renamed to url_quote.
    • Add support for native types in macros. :issue:1510

    • The {% trans %} tag can use pgettext and npgettext by passing a context string as the first token in the tag, like {% trans "title" %}. :issue:1430

    • Update valid identifier characters from Python 3.6 to 3.7. :pr:1571

    • Filters and tests decorated with @async_variant are pickleable. :pr:1612

    • Add items filter. :issue:1561

    ... (truncated)

    Commits
    • b08cd4b Merge pull request #1660 from pallets/release-3.1.2
    • 1e68ba8 release version 3.1.2
    • 8efee35 pre-commit updates latest release branch
    • a24df26 ignore new mypy finding
    • 9faee28 update requirements
    • b802b5a Merge pull request #1655 from dvitek/dvitek/issue1654
    • 746bb95 Fix race conditions in FileSystemBytecodeCache
    • 466a200 update requirements
    • 990602f Merge pull request #1647 from Tom-Brouwer/202204/add-missing-overlay-options
    • 5d3d241 fix flake8-bugbear finding
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • [New] Size limited LRU cache

    [New] Size limited LRU cache

    I made a small working prototype of the cache implementation on top of OrderedDict. Please write what can be improved.

    https://gist.github.com/ZhymabekRoman/a9c7a25c155dfdea52277cc74f28fa65

    opened by ZhymabekRoman 6
Releases(v2.3)
  • v2.3(Mar 26, 2022)

    New release for translatepy!

    translatepy v2.3

    New

    • Python 3.10 Support
    • New "Microsoft Translate" translation service

    Fixes

    • Fixing Chinese with Google Translate
    • Fixing Chinese with DeepL
    • Fixing Reverso
    • Fixing Sindarin in Yandex
    • Fixing DeepL
    • Fixing some language similarity check ... and numerous other fixes

    This is made possible thanks to all of the contributors ! ✨

    Full Changelog: https://github.com/Animenosekai/translate/compare/v2.2...v2.3

    🎐Animenosekai, 2022

    Source code(tar.gz)
    Source code(zip)
  • v2.2(Oct 25, 2021)

    New release for translatepy!

    translatepy v2.2

    New

    • HTML translation from the BaseTranslator and Translate class
    • Supported Languages checking for each translator before making any request

    Improvements

    • Better string emptiness checking
    • Type safe/hinted result models (nice when you want to code)
    • Avoid meaningless processing in Language initialization
    • Updating tests by adding tests for the Translate (Translator) class
    • Make all raised exceptions inheriting translatepy.exceptions.TranslatepyException
    Source code(tar.gz)
    Source code(zip)
  • v2.1(Sep 24, 2021)

    New release for translatepy!

    translatepy v2.1

    Some minor and major updates!

    New

    • Improved Function and Classes Documentation (ex: the Request class)
    • Lazy Loading of the translators to avoid slowing down the Translate class instantiation (on-time translator instantiation)
    • Support for a single string in the proxy_urls parameter for Request
    • Update result models string representation (__repr__)
    • New language data file : minified, fixed, more accurate
    • Language name vectors file : minified, with more information (counter) to avoid redundant computation time at startup, curated (less unused languages, making the results more accurate)
    • Custom class for language extras
    • Fast Mode (concurrent/threaded processing)
    • Isolated cache and cache duration set from Request instantiation

    … and other

    Fixes

    A lot of patches and fixes have been applied with this update:

    • Patches from #23 and #24
    • Fixing Bing's text to speech method ( aed04a7 )
    • Fixing tests
    Source code(tar.gz)
    Source code(zip)
  • v2.0(Jul 25, 2021)

    New release for translatepy!

    translatepy v2.0

    We did a lot of work to bring v2 with @ZhymabekRoman !

    Here are the features we brought into v2:

    New

    • Code Refactor
    • Interactive Mode (shell)
    • Access from other languages through the JSON-formatted CLI access
    • Proxy Management
    • New language management
    • Google Service URL parameter
    • Exceptions
    • Requests Management
    • New Tests (CI)
    • New Cache management (LRU)
    • Results Models
    • Plugins
    • LibreTranslate, MyMemory and Translate.com now come built-in with the already existing Bing Translate, DeepL, Google Translate, Reverso and Yandex Translate
    • Documentation

    … and other

    Fixes

    A lot of fixes have been made for greater performance and stability.

    Some translators have been updated and fixed such as DeepL, Google, Reverso… (although we are trying to fix Bing, it seems to change quite a lot)

    Important

    Be aware that this is a breaking update.

    Any code that was written with translatepy v1.7 and before can be broken if translatepy v2 is installed (at the high level, Translator (who is renamed internally as Translate) for example doesn’t have the use_google, use_yandex, etc. parameters anymore as they got replaced by the services_list parameter)

    Also, this version will raise exceptions if something goes wrong, as explained in the README.

    Source code(tar.gz)
    Source code(zip)
  • v1.7(May 14, 2021)

    New translatepy release!

    [add]

    • Adding a much more stable version of Yandex Translate thank's to @ZhymabekRoman (PR: #10)

    [fix]

    • Fixing a problem where the used service for translation was always Reverso (even when it wasn't)
    Source code(tar.gz)
    Source code(zip)
  • v1.6.1(Apr 26, 2021)

    translatepy minor release

    [fix]

    • Adds the pyuseragents dependency to setup.py

    [update]

    • A "destination_language" is now optional for Translator.example
    Source code(tar.gz)
    Source code(zip)
  • v1.6(Apr 25, 2021)

    New translatepy release!

    v1.6

    [add]

    • Officially supporting the text_to_speech method!
    • New endpoints for more stability!
    • A much more stable DeepL following #7
    • Adding Google's JSONRPC API (batchexecute) with transliteration, translation and language support!

    [update]

    • The code for the Translator class is much more simple, thanks to @spamz23's fork which inspired me to make it look better

    Updating the README

    Source code(tar.gz)
    Source code(zip)
  • v1.5.2(Mar 22, 2021)

    translatepy v1.5.2

    [fix]

    • Google changed their API response format once more

    https://github.com/ssut/py-googletrans/issues/268#issuecomment-803854020

    Source code(tar.gz)
    Source code(zip)
  • v1.5.1(Mar 21, 2021)

  • v1.5(Mar 2, 2021)

    translatepy v1.5

    [add]

    • Adding a text_to_speech method to GoogleTranslate() in alpha support
    • Adding a clean_cache method to clean the caches

    [fix]

    • Fixing #6 where the text wasn't correctly URL-encoded

    [update]

    • Updating the README
    Source code(tar.gz)
    Source code(zip)
  • v1.4(Feb 27, 2021)

    v1.4 Release

    [add]

    • A better Yandex SID management (according #4 )
    • Adding DeepL (translation, language and dictionary) --> #5
    • Docstrings
    • Type Hints

    [fix]

    • Backward compatibility
    • Typo

    [update]

    • Updating the classifiers (setup.py)
    • Code Quality using Pylint
    • GitHub Actions for CI/CD
    Source code(tar.gz)
    Source code(zip)
  • v1.2(Feb 14, 2021)

    New version for translatepy !

    [fix] We fixed multiple bugs, including:

    • #3 which prevented translations from Reverso

    [improvement]

    • #4 (partially?), trying to avoid rate-limits from Yandex by caching the SID

    [add]

    • #4 Letting the user choose which translator to use with the Translator class

    Note: you can still refresh automatically the SID with the yandex_refresh_sid parameter when initializing Translator()

    Note: passing Translator(False, False, False, False) will return None for every function called (no translator got selected)

    Note: The class for a translator not selected is the Unselected class which is a blank class returning None for every function

    Source code(tar.gz)
    Source code(zip)
  • v1.1(Feb 7, 2021)

    translatepy v1.1!

    [fix] We fixed multiple bugs, including #2 which prevented the translation of long sentences.

    [add] A new attribute "service" in TranslationResult which determines which service got used for the translation

    Usage:

    >>> translation = translator.translate("Hello", "Japanese")
    >>> translation.service
    <translatepy.translators.google.GoogleTranslate object at 0x104858130>
    >>> translation.service is translator.google_translate
    True
    >>> if translation.service is translator.bing_translate:
    ...    print("Used Bing Translator!")
    ... else:
    ...    print("Used other translator!")
    'Used other translator!'
    
    Source code(tar.gz)
    Source code(zip)
  • v1.0(Feb 7, 2021)

    The first version of translatepy!!

    Features:

    • Translation
    • Transliteration
    • Language Detection
    • Spell Checking
    • Word Examples
    • Caching
    • Language Handling (with a pretty big dataset)

    Services:

    • Google Translate
    • Bing
    • Yandex
    • Reverso
    Source code(tar.gz)
    Source code(zip)
Injector/automatic translator (using deepL API) for Tsukihime Remake

deepLuna Extractor/Editor/Translator/Injector for Tsukihime Remake About deepLuna, from "deepL", the machine translation service, and "Luna", the name

30 Dec 15, 2022
Stack overflow search API

Stack overflow search API

Vikash Karodiya 1 Nov 15, 2021
Contrastive Language-Audio Pretraining

CLAP Contrastive Language-Audio Pretraining In due time this repo will be full of lovely things, I hope. Feel free to check out the Issues if you're i

Charles Foster 83 Dec 01, 2022
Simple Instagram Login Link Generator

instagram-account-login Simple Instagram Login Link Generator Info Program generates instagram login links and you may get into someone´s thought the

Kevin 5 Dec 03, 2022
PYthon Warframe Market API(pywmapi)

pywmapi PYthon Warframe Market API(pywmapi) API for warframe market, written in Python. For now, the implemented function is listed below: auth sign i

AyajiLin 7 Dec 11, 2022
Bomber-X - A SMS Bomber made with Python

Bomber-X A SMS Bomber made with Python Linux/Termux apt update apt upgrade apt i

S M Shahriar Zarir 2 Mar 10, 2022
Python wrapper for the Sportradar APIs ⚽️🏈

Sportradar APIs This is a Python wrapper for the sports APIs provided by Sportradar. You'll need to sign up for an API key to use the service. Sportra

John W. Miller 39 Jan 01, 2023
A Script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag.

Channel Auto Message Forward A script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag

16 Oct 21, 2022
Moderation By Pokemon Bot (Discord)

Moderation Bot By Pokémon Bot (Discord) Official Moderation Bot for Pokemon Bot functional and based in the Discord Server, the bot is written in Pyth

Aakash Manoj Agrawal 6 Jan 04, 2022
A simple telegram bot that takes a list of files sent by the user and returns them 7zipped

A simple telegram bot that takes a list of files sent by the user and returns them 7zipped

1 Oct 28, 2022
Programa de código abierto para probar el API de Bitso, el exchange más importante de América Latina.

Bitso Semiautomático Programa de código abierto para probar el API de Bitso, el exchange más importante de América Latina. Desarrollador Fernando Mire

Fernando Mireles 17 Dec 07, 2022
Growtopia server_data.php reader with bypass method, using discord bot

Server_data.php-reader Growtopia server_data.php reader with bypass method, using discord bot How to use 1 install python 2 change your bot token

7 Jul 16, 2022
Mini Tool to lovers of debe from eksisozluk (one of the most famous website -reffered as collaborative dictionary like reddit- in Turkey) for pushing debe (Most Liked Entries of Yesterday) to kindle every day via Github Actions.

debe to kindle Mini Tool to lovers of debe from eksisozluk (one of the most famous website -refered as collaborative dictionary like reddit- in Turkey

11 Oct 11, 2022
A fully responsive interface to manage all your favorite software on your HTPC.

Python 3 port of Hellowlol's HTPC Manager fork We made this an organization repository to be more independent from single developers. If you want to j

26 Jan 04, 2023
Requests based multi-threaded script for increasing followers on Spotify

Proxyless Spotify Follow Bot Requests based multi-threaded script for increasing followers on Spotify. Click here to report bugs. Usage Download ZIP h

397 Jan 03, 2023
ro.py is a modern, asynchronous Python 3 wrapper for the Roblox API.

GitHub | Discord | PyPI | Documentation | Examples | License Overview Welcome to ro.py! ro.py is an asynchronous, object-oriented wrapper for the Robl

ro.py 81 Dec 26, 2022
使用appium进行抖音粉丝的自动化获取

DYfans 使用appium进行抖音粉丝的自动化获取 工具: appium appium inspector Fiddler 夜神模拟器或者安卓手机 mitmdump mitmproxy 推荐使用安卓5.0夜神模拟器 库: appium selenium json 环境: jdk 安卓sdk 安卓

kaba 0 Mar 25, 2022
A link shortner telegram bot version 2 with advanced features

URL-Shortner-Bot-V2 A link shortner telegram bot version 2 with advanced features Made with Python3 (C) @FayasNoushad Copyright permission under MIT L

Fayas Noushad 18 Dec 29, 2022
Script que envia e-mails de denúncia para desativar número de WhatsApp.

SpamReport (Alpha) Este script foi feito apenas para uso educacional, não me responsabilizo por qualquer uso indevido. Version: 1.0 Alpha Ative essa o

Kiny-Kiny 83 Dec 20, 2022
Official Python wrapper for the Quantel Finance API

Quantel is a powerful financial data and insights API. It provides easy access to world-class financial information. Quantel goes beyond just financial statements, giving users valuable information l

Guy 47 Oct 16, 2022