-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change translate to translate any messages not in the channel lang #44
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of questions
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you print this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an edited version of the previous function solely for translating russian, in the original it had been printed so i left it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it serves a purpose any more and could probably be taken out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this line pass the linter? Looks rather long to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah whole thing got passed
in conversation with @hreeder we discussed using google translate instead of Yandex, does anybody have any opinions either way? |
I say just go for it |
This might be a little IO heavy but I liked the idea so thought I'd take a crack