Switched to yandex.translate. Fixes #132

This commit is contained in:
Manuel Cortez 2017-05-06 05:49:00 +04:00
parent 7e6103473f
commit 6f622bdeba
3 changed files with 8 additions and 6 deletions

View File

@ -67,13 +67,13 @@ setuptools installs a script, called easy_install. You can find it in the python
* arrow==0.6
* markdown
* winpaths
* microsofttranslator
* PySocks
* win_inet_pton
* yandex.translate
easy_install will automatically get the additional libraries that these packages need to work properly.
Run the following command to quickly install and upgrade all packages and their dependencies:
easy_install -Z --upgrade six configobj goslate markdown future suds requests oauthlib requests-oauthlib requests-toolbelt pypubsub==3.3.0 pygeocoder arrow==0.6 python-dateutil futures microsofttranslator winpaths PySocks win_inet_pton
easy_install -Z --upgrade six configobj goslate markdown future suds requests oauthlib requests-oauthlib requests-toolbelt pypubsub==3.3.0 pygeocoder arrow==0.6 python-dateutil futures winpaths PySocks win_inet_pton yandex.translate
#### Other dependencies

View File

@ -4,6 +4,8 @@
* TWBlue will show an error when trying to open a timeline for a suspended user. ([#128](https://github.com/manuelcortez/TWBlue/issues/128))
* Removed TwUp as service as it no longer exists. ([#112](https://github.com/manuelcortez/TWBlue/issues/112))
* Release audio files after uploading them. ([#130](https://github.com/manuelcortez/TWBlue/issues/130))
* Now TWBlue will use Yandex's translation services instead microsoft translator. ([#132](https://github.com/manuelcortez/TWBlue/issues/132))
## Changes in version 0.90

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
from microsofttranslator import Translator
from yandex_translate import YandexTranslate
def translate(text="", source="auto", target="en"):
t = Translator("twblue", "4KZA26GYIfmVAqQA/z16Hlucbg64hVSDTIpRjT2FqIU=")
return t.translate(text, target)
t = YandexTranslate("trnsl.1.1.20161012T134532Z.d01b9c75fc39aa74.7d1be75a5166a80583eeb020e10f584168da6bf7")
return t.translate(text, target)["text"][0]
languages = {