joaoricardo000 / whatsapp-bot-seed

A small python framework to create a whatsapp bot, with regex-callback message routing.
727 stars 245 forks source link

Can we implement a translation option? #56

Open x23piracy opened 8 years ago

x23piracy commented 8 years ago

Hi,

can we use google speech api to translate text into another language? Lets say we define a default language (as input text) for example DE (German)

Then we use the switch "/l" (l like "l"anguage) followed by the destination language "EN" plus the text we need translate "Hallo Welt"

/l EN Hallo Welt

Output should be "Hallo Welt" in english "Hello World"

Regards X23

K4CZP3R commented 8 years ago

Is there Google Translate API for python?

K4CZP3R commented 8 years ago

It can go through Translate API and translated text going be generated with tts

heberholanda commented 8 years ago

Yea, can see https://developers.google.com/api-client-library/python/apis/translate/v2#system-requirements

K4CZP3R commented 8 years ago

2nd version

  1. Download - https://github.com/mouuff/Google-Translate-API
  2. Copy GoogleTranslate.py from this github to whatsapp-bot-seed/src/
  3. Download my view and copy it to whatsapp-bot-seed/src/views/ - https://mega.nz/#!E4hFRJ5B!ugDyJ1Gkyu7DaN2UouRiwtKqasYLKgc7QcsDn-mQioA
  4. Add to import list of router.py (located at whatsapp-bot-seed/src/) from views.translate_k import TranslateK
  5. Add below class RouteLayer in router.py routes.extend(TranslateK(self).routes)
K4CZP3R commented 8 years ago

To use this view your text have to be in "" and dest. language doesn't have to be in ""

Usage: /t "Hello World" nl

(sends audio with "Hello Wereld) Translated Org Text: Hello World Translated: Hello Wereld

K4CZP3R commented 8 years ago

Added pull request :+1:

K4CZP3R commented 8 years ago

62

x23piracy commented 8 years ago

Hi,

perfect i don't had the time to test yet but it sounds like a final and working solution, so thumbs up :+1: I get back when tested.

Regards X23