change translate to translate any messages not in the channel lang#44
Open
himmelmaus wants to merge 3 commits intohreeder:masterfrom
Open
change translate to translate any messages not in the channel lang#44himmelmaus wants to merge 3 commits intohreeder:masterfrom
himmelmaus wants to merge 3 commits intohreeder:masterfrom
Conversation
neanias
reviewed
Apr 11, 2018
| translate_url = "https://translate.yandex.net/api/v1.5/tr.json/translate?key={}&text={}&lang={}-{}".format(api_key, text, lang, bot.config["System"]["lang"]) | ||
| api_response = requests.get(translate_url).text | ||
| api_json = json.loads(api_response) | ||
| print(api_json) |
Contributor
Author
There was a problem hiding this comment.
this is an edited version of the previous function solely for translating russian, in the original it had been printed so i left it
Collaborator
There was a problem hiding this comment.
I'm not sure it serves a purpose any more and could probably be taken out
| def translate(bot, text): | ||
| api_key = bot.config['Yandex']['translate_key'] | ||
| lang = detect(text) | ||
| translate_url = "https://translate.yandex.net/api/v1.5/tr.json/translate?key={}&text={}&lang={}-{}".format(api_key, text, lang, bot.config["System"]["lang"]) |
Collaborator
There was a problem hiding this comment.
Does this line pass the linter? Looks rather long to me
Contributor
Author
There was a problem hiding this comment.
yeah whole thing got passed
Contributor
Author
|
in conversation with @hreeder we discussed using google translate instead of Yandex, does anybody have any opinions either way? |
Collaborator
|
I say just go for it |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This might be a little IO heavy but I liked the idea so thought I'd take a crack