Thursday, December 08, 2016

Using Tasker to Streamline Google Translate

As travel aids go, Google Translate is a serious Game Changer. Sure the ability to type in text and get an instant translation (even without a network) is cool, but the on-the-fly image translation is downright magical. To hold up your phone to a restaurant's menu and see that menu instantly translated to English is to be living in a Sci-Fi novel. Here's a quick example of this behavior in action:

If I could level any complaint against Google Translate is that it's too sophisticated. Thinking back to our last trip, it would be have been neat to have a streamlined translation UI. Oh I don't know, perhaps a UI where I press an icon on my home screen, say whatever phrase I want translated, and poof! see it in Spanish. Thanks to Tasker, I was able to whip this up in just a few minutes. Here's my code in action:

Note that I have two widgets on my home screen, one to translate from English to Spanish and one to translate from Spanish to English. The idea is that I can press a button, say something and get a translation. I can then hold my phone up to a stranger and have them recite their question in Spanish. OK, it's not exactly a Bable fish, but for 15 minutes of hacking, it's still pretty sweet if you ask me.

My (very tiny) Tasker app works using two clever tricks. First, the Get Voice action which prompts the speaker to say something and turns into text, takes in a a language variable. Therefore, it's trivial to make Tasker understand Spanish or any other language that Google supports. The other is that you can communicate with Google Translate using an Android Intent. I originally learned about this here.

There are various recipes on the web for invoking Google Translate, but I found the one that work most reliably was this one. Here are the specific parameters I'm using in the Send Intent action:

 Action: android.intent.action.VIEW
 Cat: Browseable
         q=[text to translate]
 Extra: { "type": "String", "name": "Browser Id",
          "description": "Do not change this value",   
          "key": "", 
          "default": ""     }
 Target: Activity

Here's the finished task:

Enjoy, and happy travels!


  1. Can you share a link to download this task? I might be missing something I can't get it top work :(

  2. @NEON_ARMOR -

    It's been years since I've used this task, and the latest version of Google Translate offers a conversation mode that does something similar. But with that said, here's an attempt to export the files for sharing:

    Hope that helps!