<!doctype html>
<head>
<meta charset="utf-8">
<title>Google Four Textareas Translate via Yql - RJM Programming - 2014</title>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<script type='text/javascript'>
var yehbut="";
var done="";
var hlang="en";
var tlang="en";
var wo=null;
var cols=['lime','black','blue','purple','navy','teal','fuchsia','olive','maroon','gray','green'];
var icols=0;
var nextfocus = 'ta11';
function savelook() {
document.getElementById('icols').value = icols;
document.getElementById('nextfocus').value = nextfocus;
document.getElementById('postlanguage1').value = document.getElementById('language1').value;
document.getElementById('postlanguage2').value = document.getElementById('language2').value;
document.getElementById(nextfocus).focus();
document.getElementById('submit').click();
}
function ChangeLcodeHNow(lis) {
done="y";
hlang = lis;
}
function ChangeLcodeTNow(lis) {
tlang = lis;
}
function andprethen() {
yehbut='';
}
function andthen() {
if (yehbut == "" && wo) {
wo.close();
wo=null;
}
}
function embellish(retval,outoid) {
var ourcol=cols[icols];
var earout="";
if (retval != "") {
//alert(999);
var l1=document.getElementById("language1");
var l2=document.getElementById("language2");
var l2value = "en"; //"auto";
var l1value = "en"; //"auto";
//alert(998);
if (l1.value != "") l1value = l1.value;
if (l2.value != "") l2value = l2.value;
if (outoid.indexOf("preta12") != -1) { // top right
earout = " <a style=\"text-decoration:none;\" title=\"Listen\" href=# onclick=\" yehbut='y'; if (wo) { wo.close(); wo=null; } wo=window.open('http://translate.google.com/translate_tts?tl=" + l1value + "&q=" + retval.replace(/ /g, '%20').replace(/'/g, '').replace(/(\r\n|\n|\r)/gm,"") + "', '" + l1.value + "" + l2.value + "', 'left=1280,top=300,width=40,height=40'); setTimeout(andprethen,2000); setTimeout(andthen,8000); \">👂</a>";
retval = "<font color='" + ourcol + "'>" + retval + "</font>";
document.getElementById('postta12').value = document.getElementById('postta12').value + "<br>" + retval.replace(/</g, '<').replace(/>/g, '>') + earout.replace(/</g, '<').replace(/>/g, '>');
} else if (outoid.indexOf("preta21") != -1) {
earout = " <a style=\"text-decoration:none;\" title=\"Listen\" href=# onclick=\" yehbut='y'; if (wo) { wo.close(); wo=null; } wo=window.open('http://translate.google.com/translate_tts?tl=" + l2value + "&q=" + retval.replace(/ /g, '%20').replace(/'/g, '').replace(/(\r\n|\n|\r)/gm,"") + "', '" + l2.value + "" + l1.value + "', 'left=120,top=600,width=40,height=40'); setTimeout(andprethen,2000); setTimeout(andthen,8000); \">👂</a>";
retval = "<font color='" + ourcol + "'>" + retval + "</font>";
document.getElementById('postta21').value = document.getElementById('postta21').value + "<br>" + retval.replace(/</g, '<').replace(/>/g, '>') + earout.replace(/</g, '<').replace(/>/g, '>');
} else if (outoid.indexOf("preta1") != -1) { // top left
icols = eval((icols + 1) % cols.length);
ourcol=cols[icols];
earout = " <a style=\"text-decoration:none;\" title=\"Listen\" href=# onclick=\" yehbut='y'; if (wo) { wo.close(); wo=null; } wo=window.open('http://translate.google.com/translate_tts?tl=" + l2value + "&q=" + retval.replace(/ /g, '%20').replace(/'/g, '').replace(/(\r\n|\n|\r)/gm,"") + "', '" + l2.value + "_" + l1.value + "', 'left=120,top=300,width=40,height=40'); setTimeout(andprethen,2000); setTimeout(andthen,8000); \">👂</a>";
retval = "<font color='" + ourcol + "'>" + retval + "</font>";
document.getElementById('ta11').style.border = '';
document.getElementById('ta22').style.border = 'yellow 3px solid';
nextfocus = 'ta22';
document.getElementById('postta11').value = document.getElementById('postta11').value + "<br>" + retval.replace(/</g, '<').replace(/>/g, '>') + earout.replace(/</g, '<').replace(/>/g, '>');
} else if (outoid.indexOf("preta2") != -1) {
earout = " <a style=\"text-decoration:none;\" title=\"Listen\" href=# onclick=\" yehbut='y'; if (wo) { wo.close(); wo=null; } wo=window.open('http://translate.google.com/translate_tts?tl=" + l1value + "&q=" + retval.replace(/ /g, '%20').replace(/'/g, '').replace(/(\r\n|\n|\r)/gm,"") + "', '" + l1.value + "_" + l2.value + "', 'left=1280,top=600,width=40,height=40'); setTimeout(andprethen,2000); setTimeout(andthen,8000); \">👂</a>";
retval = "<font color='" + ourcol + "'>" + retval + "</font>";
document.getElementById('ta22').style.border = '';
document.getElementById('ta11').style.border = 'yellow 3px solid';
nextfocus = 'ta11';
document.getElementById('postta22').value = document.getElementById('postta22').value + "<br>" + retval.replace(/</g, '<').replace(/>/g, '>') + earout.replace(/</g, '<').replace(/>/g, '>');
}
//alert(997);
}
if (document.getElementById('sharing').innerHTML == "") {
document.getElementById('sharing').innerHTML = "<input type='button' id='bsharing' onclick='savelook();' title='Optionally Share (with Friends) via Email a Snapshot of the Translated Conversation' value='Share Conversation' />";
}
return retval + earout;
}
function justchecking() {
var l1 = (location.search.split('tl=')[1] ? location.search.split('tl=')[1].split('&')[0] : ''.replace('TjunkL',''));
if (l1 != "") document.getElementById('language1').value = l1;
done=document.getElementById('language1').value;
var l2 = (location.search.split('sl=')[1] ? location.search.split('sl=')[1].split('&')[0] : ''.replace('SjunkL',''));
if (l2 != "") document.getElementById('language2').value = l2;
var preta11="";
var preta12="";
var preta21="";
var preta22="";
preta11 = (location.search.split('preta11=')[1] ? location.search.split('preta11=')[1].split('&')[0] : preta11.replace('preta11',''));
preta12 = (location.search.split('preta12=')[1] ? location.search.split('preta12=')[1].split('&')[0] : preta12.replace('preta12',''));
preta21 = (location.search.split('preta21=')[1] ? location.search.split('preta21=')[1].split('&')[0] : preta21.replace('preta21',''));
preta22 = (location.search.split('preta22=')[1] ? location.search.split('preta22=')[1].split('&')[0] : preta22.replace('preta22',''));
if (preta11.length > 0) document.getElementById('preta11').innerHTML = preta11;
if (preta12.length > 0) document.getElementById('preta12').innerHTML = preta12;
if (preta21.length > 0) document.getElementById('preta21').innerHTML = preta21;
if (preta22.length > 0) document.getElementById('preta22').innerHTML = preta22;
}
</script>
</head>
<body align='center' style=" background-color: lightgray; " onload="justchecking();">
<br><h1 align='center' title='Call in your partner speaking the other language and type in what you want to convey (or say) in the textarea with the yellow border, then let your partner have their turn (typing) in the other textarea ... happy "talking".'> Google For Two Translate ... One Sentence (To Write/Listen To) at a Time</h1>
<div align='center'>
<table>
<tbody>
<tr><td align='center' id='preta11'></td><td></td><td></td><td></td><td align='center' id='preta12'></td></tr>
<tr>
<td>
<textarea onfocus=' if (done == "") { done="y"; var tlang=prompt("Before proceeding, please check top language dropdown setting, or enter its code here, if you know it (eg. English is en).","en"); if (tlang != null) { if (tlang != "") { document.getElementById("language1").value=tlang; this.focus(); } } } var prex = document.getElementById("preta21"); var x = document.getElementById("ta21"); var y = (x.contentWindow || x.contentDocument); if (y.document) { y = y.document; } prex.innerHTML=prex.innerHTML + "<br>" + embellish(y.body.innerHTML,prex.id); y.body.innerHTML = ""; ' onblur=' if (this.value != "") { var xx="./google_four_translate.php?language1=" + document.getElementById("language1").value + "&ta11=" + encodeURIComponent(this.value); var omif=document.getElementById("ta12"); document.getElementById("preta11").innerHTML=document.getElementById("preta11").innerHTML + "<br>" + embellish(this.value,"preta11"); omif.src = xx; this.value=""; } ' id='ta11' name='ta11' value='' rows=10 cols=40 style='background-color:lightgreen;border:3px yellow solid;'></textarea>
</td><td>→</td><td>
<select onchange="ChangeLcodeHNow(this.value);" title="Translations courtesy of YQL google.translate database (ie. https://developer.yahoo.com/yql/console/?q=select%20*%20from%20flickr.photos.interestingness%2820%29&env=store://datatables.org/alltableswithkeys#h=select+*+from+google.translate+where+q%3D%22was+ist+das%22+and+target%3D%22de%22%3B ) of Google Translate at http://translate.google.com/" id="language1" name="language1" style="background-color:lightblue;color:blue;"><option value="">Language</option><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese (Simplified)</option><option value="zh-TW">Chinese (Traditional)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="ht">Haitian Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="ko">Korean</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select>
</td><td>→</td><td>
<iframe id='ta12' name='ta12' src='google_four_translate.php' style='height:140px;background-color:pink;'></iframe>
</td>
</tr>
<tr><td align='center'>▲</td><td></td><td id='sharing' name='sharing' align='center'></td><td></td><td align='center'>▼</td></tr>
<tr><td align='center' id='preta21'></td><td></td><td></td><td></td><td align='center' id='preta22'></td></tr>
<tr>
<td>
<iframe id='ta21' name='ta21' src='google_four_translate.php' style='height:140px;background-color:pink;'></iframe>
</td><td>←</td><td>
<select onchange="ChangeLcodeTNow(this.value);" title="Translations courtesy of YQL google.translate database (ie. https://developer.yahoo.com/yql/console/?q=select%20*%20from%20flickr.photos.interestingness%2820%29&env=store://datatables.org/alltableswithkeys#h=select+*+from+google.translate+where+q%3D%22was+ist+das%22+and+target%3D%22de%22%3B ) of Google Translate at http://translate.google.com/" id="language2" name="language2" style="background-color:lightgreen;color:blue;"><option value="">Language</option><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese (Simplified)</option><option value="zh-TW">Chinese (Traditional)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="ht">Haitian Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="ko">Korean</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select>
</td><td>←</td><td>
<textarea onfocus=' var prex = document.getElementById("preta12"); var x = document.getElementById("ta12"); var y = (x.contentWindow || x.contentDocument); if (y.document) { y = y.document; } prex.innerHTML=prex.innerHTML + "<br>" + embellish(y.body.innerHTML,prex.id); y.body.innerHTML = ""; ' onblur=' if (this.value != "") { var xx="./google_four_translate.php?language2=" + document.getElementById("language2").value + "&ta22=" + encodeURIComponent(this.value); var omif=document.getElementById("ta21"); document.getElementById("preta22").innerHTML=document.getElementById("preta22").innerHTML + "<br>" + embellish(this.value,"preta22"); omif.src = xx; this.value=""; } ' id='ta22' name='ta22' value='' rows=10 cols=40 style='background-color:lightblue;'></textarea>
</td>
</tr>
</tbody>
</table>
</div>
<form style="display:none;" id="myf" action="google_four_translate.php" method="POST">
<input type="hidden" name="preta11" id="postta11" value=""></input>
<input type="hidden" name="preta12" id="postta12" value=""></input>
<input type="hidden" name="preta21" id="postta21" value=""></input>
<input type="hidden" name="preta22" id="postta22" value=""></input>
<input type="hidden" name="prelanguage1" id="postlanguage1" value=""></input>
<input type="hidden" name="prelanguage2" id="postlanguage2" value=""></input>
<input type="hidden" name="nextfocus" id="nextfocus" value=""></input>
<input type="hidden" name="icols" id="icols" value="0"></input>
<input style="display:none;" type="submit" name="submit" id="submit" value="Submit"></input>
</form>
</body>
</html>