Skip to content

Conversation

@himmelmaus
Copy link
Contributor

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

Copy link
Collaborator

@neanias neanias left a 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)
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alt text

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"])
Copy link
Collaborator

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

Copy link
Contributor Author

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

@himmelmaus
Copy link
Contributor Author

in conversation with @hreeder we discussed using google translate instead of Yandex, does anybody have any opinions either way?

@neanias
Copy link
Collaborator

neanias commented Oct 18, 2018

I say just go for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants