Is there a way to translate texts using tasker?

1,013 views
Skip to first unread message

GJD

unread,
Apr 23, 2014, 2:56:06 AM4/23/14
to tas...@googlegroups.com
I'm currently playing with the say action using TTS.
So i set this up to speak out any notification title when i'm at home or in the car.
But the main problem is, that i'm using 2 languages (English and Dutch). 
And from a peace of text there is no way for me to determine what language it is, for choosing the right TTS engine.

So i was thinking of throwing the text always through a translator, to use only one TTS engine.

Is there a way to do this. Perhaps with Google Translate app or website.

Antarion

unread,
Apr 23, 2014, 7:54:18 AM4/23/14
to tas...@googlegroups.com
Hi GJD,

Good to see there are fellow dutchmen on this page (although I will keep it in English so someone else could still use this)

The task is rather simple:

Variable search replace: %MESSAGE search: (a space character) replace:%20
Perform a HTTP get to the following URL: http://translate.google.be/#auto/nl/%MESSAGE
 ! If you are using a different language the'nl' needs be replaced by the destination laguage's code again
Variable split %HTTPD splitter: <span id="result_box" class="short_text" lang="nl"><span class="hps">
 ! If you are using a different language the lang parameter needs be replaced by the destination laguage's code
Variable split %HTTPD2 splitter: </span></span>

%HTTPD21 should contain your message now (haven't tested it with Tasker, I just searched in Chrome's dev console)
The source can be any language

Op woensdag 23 april 2014 08:56:06 UTC+2 schreef GJD:

GJD

unread,
Apr 23, 2014, 10:40:55 AM4/23/14
to tas...@googlegroups.com
Thanks for the suggestion.
But i don't think this would be a steady solution. Because of the dependecies of the source page being the same. What if google decides to make some changes?

I did tried it. And it wasn't working.
For the test i did a HTTP Get on the port "translate.google.be/#auto/nl/test%20message"
But on the result, (written to a file) was the test string not put in the site, so there was nothing to translate.

When i put the string in the URL of my browser (on the PC), i did get a translation, but on the source, i couldn't find the result a text in the source. Searched on "testbericht" which was seen on the site.

But maybe another command is needed.



Op woensdag 23 april 2014 13:54:18 UTC+2 schreef Antarion:

GJD

unread,
Apr 23, 2014, 10:49:11 AM4/23/14
to tas...@googlegroups.com
Besides, the title of a notification could have also other characters than only a space. Like comma, dash, minus, ect. These characters needs also be converted into a correct URL address.


Op woensdag 23 april 2014 08:56:06 UTC+2 schreef GJD:
I'm currently playing with the say action using TTS.

Matt R

unread,
Apr 23, 2014, 12:30:21 PM4/23/14
to tas...@googlegroups.com
For that, there's the Tasker action variable -> variable convert -> URL encode/decode.

Matt

GJD

unread,
Apr 24, 2014, 3:06:14 AM4/24/14
to tas...@googlegroups.com
I'm getting with every try the same results in the %HTTPD

I'm now on a PC and when i put in the URL (http://translate.google.nl/m/translate#auto/nl/test message), 
i still get the same results in the page source. It seems that there is a script running, which can not display the results on the HTTP Get command.

<!DOCTYPE html>
<html manifest="/m/manifest">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0">
<style type="text/css">
</style>
<link rel="stylesheet" type="text/css" href="/translate/releases/twsfe_w_20140421_RC03/r/css/webapp_ltr.css" />
<title>Google Translate</title>
</head>
<body dir="ltr">
<div class="gp-titlebar">
<div><span class="gp-title">Vertaal</span></div>
</div>
<script>
DATA = {
"SourceLanguageCodeNameList":{
"0":{
"Code":"auto"
,
"Name":"Taal herkennen"
}
,
"1":{
"Code":"af"
,
"Name":"Afrikaans"
}
,
"2":{
"Code":"sq"
,
"Name":"Albanees"
}
,
"3":{
"Code":"ar"
,
"Name":"Arabisch"
}
,
"4":{
"Code":"hy"
,
"Name":"Armeens"
}
,
"5":{
"Code":"az"
,
"Name":"Azerbeidzjaans"
}
,
"6":{
"Code":"eu"
,
"Name":"Baskisch"
}
,
"7":{
"Code":"bn"
,
"Name":"Bengaals"
}
,
"8":{
"Code":"bs"
,
"Name":"Bosnisch"
}
,
"9":{
"Code":"bg"
,
"Name":"Bulgaars"
}
,
"10":{
"Code":"ca"
,
"Name":"Catalaans"
}
,
"11":{
"Code":"ceb"
,
"Name":"Cebuano"
}
,
"12":{
"Code":"zh-CN"
,
"Name":"Chinees"
}
,
"13":{
"Code":"da"
,
"Name":"Deens"
}
,
"14":{
"Code":"de"
,
"Name":"Duits"
}
,
"15":{
"Code":"en"
,
"Name":"Engels"
}
,
"16":{
"Code":"eo"
,
"Name":"Esperanto"
}
,
"17":{
"Code":"et"
,
"Name":"Ests"
}
,
"18":{
"Code":"fi"
,
"Name":"Fins"
}
,
"19":{
"Code":"fr"
,
"Name":"Frans"
}
,
"20":{
"Code":"gl"
,
"Name":"Gallicisch"
}
,
"21":{
"Code":"ka"
,
"Name":"Georgisch"
}
,
"22":{
"Code":"el"
,
"Name":"Grieks"
}
,
"23":{
"Code":"gu"
,
"Name":"Gujarati"
}
,
"24":{
"Code":"ht"
,
"Name":"Haïtiaans Creools"
}
,
"25":{
"Code":"ha"
,
"Name":"Hausa"
}
,
"26":{
"Code":"iw"
,
"Name":"Hebreeuws"
}
,
"27":{
"Code":"hi"
,
"Name":"Hindoestaans"
}
,
"28":{
"Code":"hmn"
,
"Name":"Hmong"
}
,
"29":{
"Code":"hu"
,
"Name":"Hongaars"
}
,
"30":{
"Code":"ga"
,
"Name":"Iers"
}
,
"31":{
"Code":"ig"
,
"Name":"Igbo"
}
,
"32":{
"Code":"is"
,
"Name":"IJslands"
}
,
"33":{
"Code":"id"
,
"Name":"Indonesisch"
}
,
"34":{
"Code":"it"
,
"Name":"Italiaans"
}
,
"35":{
"Code":"ja"
,
"Name":"Japans"
}
,
"36":{
"Code":"jw"
,
"Name":"Javaans"
}
,
"37":{
"Code":"yi"
,
"Name":"Jiddisch"
}
,
"38":{
"Code":"kn"
,
"Name":"Kannada"
}
,
"39":{
"Code":"km"
,
"Name":"Khmer"
}
,
"40":{
"Code":"ko"
,
"Name":"Koreaans"
}
,
"41":{
"Code":"hr"
,
"Name":"Kroatisch"
}
,
"42":{
"Code":"lo"
,
"Name":"Lao"
}
,
"43":{
"Code":"la"
,
"Name":"Latijn"
}
,
"44":{
"Code":"lv"
,
"Name":"Lets"
}
,
"45":{
"Code":"lt"
,
"Name":"Litouws"
}
,
"46":{
"Code":"mk"
,
"Name":"Macedonisch"
}
,
"47":{
"Code":"ms"
,
"Name":"Maleis"
}
,
"48":{
"Code":"mt"
,
"Name":"Maltees"
}
,
"49":{
"Code":"mi"
,
"Name":"Maori"
}
,
"50":{
"Code":"mr"
,
"Name":"Marathi"
}
,
"51":{
"Code":"mn"
,
"Name":"Mongools"
}
,
"52":{
"Code":"nl"
,
"Name":"Nederlands"
}
,
"53":{
"Code":"ne"
,
"Name":"Nepalees"
}
,
"54":{
"Code":"no"
,
"Name":"Noors"
}
,
"55":{
"Code":"uk"
,
"Name":"Oekraïens"
}
,
"56":{
"Code":"fa"
,
"Name":"Perzisch"
}
,
"57":{
"Code":"pl"
,
"Name":"Pools"
}
,
"58":{
"Code":"pt"
,
"Name":"Portugees"
}
,
"59":{
"Code":"pa"
,
"Name":"Punjabi"
}
,
"60":{
"Code":"ro"
,
"Name":"Roemeens"
}
,
"61":{
"Code":"ru"
,
"Name":"Russisch"
}
,
"62":{
"Code":"sr"
,
"Name":"Servisch"
}
,
"63":{
"Code":"sk"
,
"Name":"Slovaaks"
}
,
"64":{
"Code":"sl"
,
"Name":"Sloveens"
}
,
"65":{
"Code":"so"
,
"Name":"Somalisch"
}
,
"66":{
"Code":"es"
,
"Name":"Spaans"
}
,
"67":{
"Code":"sw"
,
"Name":"Swahili"
}
,
"68":{
"Code":"tl"
,
"Name":"Tagalog"
}
,
"69":{
"Code":"ta"
,
"Name":"Tamil"
}
,
"70":{
"Code":"te"
,
"Name":"Telugu"
}
,
"71":{
"Code":"th"
,
"Name":"Thai"
}
,
"72":{
"Code":"cs"
,
"Name":"Tsjechisch"
}
,
"73":{
"Code":"tr"
,
"Name":"Turks"
}
,
"74":{
"Code":"ur"
,
"Name":"Urdu"
}
,
"75":{
"Code":"vi"
,
"Name":"Vietnamees"
}
,
"76":{
"Code":"cy"
,
"Name":"Wels"
}
,
"77":{
"Code":"be"
,
"Name":"Wit-Russisch"
}
,
"78":{
"Code":"yo"
,
"Name":"Yoruba"
}
,
"79":{
"Code":"zu"
,
"Name":"Zoeloe"
}
,
"80":{
"Code":"sv"
,
"Name":"Zweeds"
}
}
,
"TargetLanguageCodeNameList":{
"0":{
"Code":"af"
,
"Name":"Afrikaans"
}
,
"1":{
"Code":"sq"
,
"Name":"Albanees"
}
,
"2":{
"Code":"ar"
,
"Name":"Arabisch"
}
,
"3":{
"Code":"hy"
,
"Name":"Armeens"
}
,
"4":{
"Code":"az"
,
"Name":"Azerbeidzjaans"
}
,
"5":{
"Code":"eu"
,
"Name":"Baskisch"
}
,
"6":{
"Code":"bn"
,
"Name":"Bengaals"
}
,
"7":{
"Code":"bs"
,
"Name":"Bosnisch"
}
,
"8":{
"Code":"bg"
,
"Name":"Bulgaars"
}
,
"9":{
"Code":"ca"
,
"Name":"Catalaans"
}
,
"10":{
"Code":"ceb"
,
"Name":"Cebuano"
}
,
"11":{
"Code":"zh-TW"
,
"Name":"Chinees (traditioneel)"
}
,
"12":{
"Code":"zh-CN"
,
"Name":"Chinees (vereenvoudigd)"
}
,
"13":{
"Code":"da"
,
"Name":"Deens"
}
,
"14":{
"Code":"de"
,
"Name":"Duits"
}
,
"15":{
"Code":"en"
,
"Name":"Engels"
}
,
"16":{
"Code":"eo"
,
"Name":"Esperanto"
}
,
"17":{
"Code":"et"
,
"Name":"Ests"
}
,
"18":{
"Code":"fi"
,
"Name":"Fins"
}
,
"19":{
"Code":"fr"
,
"Name":"Frans"
}
,
"20":{
"Code":"gl"
,
"Name":"Gallicisch"
}
,
"21":{
"Code":"ka"
,
"Name":"Georgisch"
}
,
"22":{
"Code":"el"
,
"Name":"Grieks"
}
,
"23":{
"Code":"gu"
,
"Name":"Gujarati"
}
,
"24":{
"Code":"ht"
,
"Name":"Haïtiaans Creools"
}
,
"25":{
"Code":"ha"
,
"Name":"Hausa"
}
,
"26":{
"Code":"iw"
,
"Name":"Hebreeuws"
}
,
"27":{
"Code":"hi"
,
"Name":"Hindoestaans"
}
,
"28":{
"Code":"hmn"
,
"Name":"Hmong"
}
,
"29":{
"Code":"hu"
,
"Name":"Hongaars"
}
,
"30":{
"Code":"ga"
,
"Name":"Iers"
}
,
"31":{
"Code":"ig"
,
"Name":"Igbo"
}
,
"32":{
"Code":"is"
,
"Name":"IJslands"
}
,
"33":{
"Code":"id"
,
"Name":"Indonesisch"
}
,
"34":{
"Code":"it"
,
"Name":"Italiaans"
}
,
"35":{
"Code":"ja"
,
"Name":"Japans"
}
,
"36":{
"Code":"jw"
,
"Name":"Javaans"
}
,
"37":{
"Code":"yi"
,
"Name":"Jiddisch"
}
,
"38":{
"Code":"kn"
,
"Name":"Kannada"
}
,
"39":{
"Code":"km"
,
"Name":"Khmer"
}
,
"40":{
"Code":"ko"
,
"Name":"Koreaans"
}
,
"41":{
"Code":"hr"
,
"Name":"Kroatisch"
}
,
"42":{
"Code":"lo"
,
"Name":"Lao"
}
,
"43":{
"Code":"la"
,
"Name":"Latijn"
}
,
"44":{
"Code":"lv"
,
"Name":"Lets"
}
,
"45":{
"Code":"lt"
,
"Name":"Litouws"
}
,
"46":{
"Code":"mk"
,
"Name":"Macedonisch"
}
,
"47":{
"Code":"ms"
,
"Name":"Maleis"
}
,
"48":{
"Code":"mt"
,
"Name":"Maltees"
}
,
"49":{
"Code":"mi"
,
"Name":"Maori"
}
,
"50":{
"Code":"mr"
,
"Name":"Marathi"
}
,
"51":{
"Code":"mn"
,
"Name":"Mongools"
}
,
"52":{
"Code":"nl"
,
"Name":"Nederlands"
}
,
"53":{
"Code":"ne"
,
"Name":"Nepalees"
}
,
"54":{
"Code":"no"
,
"Name":"Noors"
}
,
"55":{
"Code":"uk"
,
"Name":"Oekraïens"
}
,
"56":{
"Code":"fa"
,
"Name":"Perzisch"
}
,
"57":{
"Code":"pl"
,
"Name":"Pools"
}
,
"58":{
"Code":"pt"
,
"Name":"Portugees"
}
,
"59":{
"Code":"pa"
,
"Name":"Punjabi"
}
,
"60":{
"Code":"ro"
,
"Name":"Roemeens"
}
,
"61":{
"Code":"ru"
,
"Name":"Russisch"
}
,
"62":{
"Code":"sr"
,
"Name":"Servisch"
}
,
"63":{
"Code":"sk"
,
"Name":"Slovaaks"
}
,
"64":{
"Code":"sl"
,
"Name":"Sloveens"
}
,
"65":{
"Code":"so"
,
"Name":"Somalisch"
}
,
"66":{
"Code":"es"
,
"Name":"Spaans"
}
,
"67":{
"Code":"sw"
,
"Name":"Swahili"
}
,
"68":{
"Code":"tl"
,
"Name":"Tagalog"
}
,
"69":{
"Code":"ta"
,
"Name":"Tamil"
}
,
"70":{
"Code":"te"
,
"Name":"Telugu"
}
,
"71":{
"Code":"th"
,
"Name":"Thai"
}
,
"72":{
"Code":"cs"
,
"Name":"Tsjechisch"
}
,
"73":{
"Code":"tr"
,
"Name":"Turks"
}
,
"74":{
"Code":"ur"
,
"Name":"Urdu"
}
,
"75":{
"Code":"vi"
,
"Name":"Vietnamees"
}
,
"76":{
"Code":"cy"
,
"Name":"Wels"
}
,
"77":{
"Code":"be"
,
"Name":"Wit-Russisch"
}
,
"78":{
"Code":"yo"
,
"Name":"Yoruba"
}
,
"79":{
"Code":"zu"
,
"Name":"Zoeloe"
}
,
"80":{
"Code":"sv"
,
"Name":"Zweeds"
}
}
,
"DisplayLanguage":"nl"
,
"MaybeDefaultSourceLanguageCode":"nl"
,
"MaybeDefaultTargetLanguageCode":"en"
,
"UserInputQuery":""
,
"Messages":{
"TRANSLATE":"Vertaal"
,
"CLEAR_THIS_LOCATION_LIST":"Deze lijst wissen"
,
"CLEAR_THIS_LIST":"Deze lijst wissen"
,
"COPYRIGHT_RAW":"\x26copy\x3B2013 Google"
,
"HELP_AND_TERMS":"Help en Voorwaarden"
,
"VIEW":"Weergave:"
,
"MOBILE":"Mobiel"
,
"CLASSIC":"Klassiek"
,
"STARRED_SECTION_TITLE":"Met ster"
,
"HISTORY_SECTION_TITLE":"Geschiedenis"
,
"SPELLING_SUGGEST":"Bedoelde u:"
,
"FOOTER_HELP":"Help"
,
"TRANS_IN_PROGRESS":"Wordt vertaald..."
,
"UNABLE_TO_TRANSLATE_REQUEST":"We kunnen uw vertaalverzoek helaas niet voltooien."
,
"DICTIONARY":"Woordenboek"
,
"TRANSLATION":"Vertaling"
,
"DID_YOU_MEAN":"Bedoelde u:"
}
};
</script>
<script src="/translate/releases/twsfe_w_20140421_RC03/r/js/translate_m.js"></script>
<script type="text/javascript">init()</script>
</body>
</html>

Op woensdag 23 april 2014 08:56:06 UTC+2 schreef GJD:
I'm currently playing with the say action using TTS.

GJD

unread,
Apr 24, 2014, 3:56:55 AM4/24/14
to tas...@googlegroups.com
Little update on my research.

Seems like the google translate is now a paid service. And you can only use this with your own KEY, supplied by google.
I registered myself and activated this module.
But on tries, it error out.
Looking back on the google developers console, i see my attempts, but error out, due to no attempts available, because i didn't pay this.

So looks like the google translate is out for my options.

Are there other ways to do this?



Op woensdag 23 april 2014 08:56:06 UTC+2 schreef GJD:
I'm currently playing with the say action using TTS.

GJD

unread,
Apr 24, 2014, 4:38:59 AM4/24/14
to tas...@googlegroups.com
Got it working now.

Found this

And is a work around. I translated into the url needed and got an output.


Giving the result:
{"sentences":[{"trans":"testbericht","orig":"test message","translit":"","src_translit":""}],"src":"en","server_time":33}

Without the "client=j" it is not working.


Op woensdag 23 april 2014 08:56:06 UTC+2 schreef GJD:
I'm currently playing with the say action using TTS.

Enrique Ortiz

unread,
Apr 13, 2015, 1:42:50 AM4/13/15
to tas...@googlegroups.com
I can access the URL from my PC and I got a f.txt with the result. How can I retrieve it from Tasker. I tried via HTTP Get but I get an I/O error. I'm new on this.
How should I parse or catch the file?

Thanks,

technogeezer

unread,
Apr 20, 2015, 7:24:55 AM4/20/15
to tas...@googlegroups.com
If you find yourself getting tired of messing with and working around google translate, try this.

http://mymemory.translated.net/doc/spec.php

It returns better translations, IMHO.

HTH



Luis Gómez Guzmán

unread,
Oct 24, 2016, 10:13:45 AM10/24/16
to Tasker

John Doe

unread,
Oct 24, 2016, 1:34:22 PM10/24/16
to Tasker
I know it's an old thread but I had the same problem. Instead of translating the message you can recognize directly from Tasker the languange, then use the right TTS voice. In order to do that you can use Tasker Now plugin, using the Lang detection action. The action doesn't require an active connection since the elaboration is offline.

Luis Gómez Guzmán

unread,
Oct 24, 2016, 1:38:19 PM10/24/16
to Tasker
That's great!, but for me, i'm not trying to use TTS, so the above solution works just fine.

gary scarborough

unread,
Oct 24, 2016, 8:47:39 PM10/24/16
to Tasker
Message has been deleted

Luis Gómez Guzmán

unread,
Oct 26, 2016, 12:46:19 PM10/26/16
to Tasker
Thank for the tip!, but i'm trying to use a least apps as possible, and above works so...

Regards,

gary scarborough

unread,
Oct 26, 2016, 4:00:19 PM10/26/16
to tas...@googlegroups.com

Heard


--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/mQI0bzfygcE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages