View Single Post
Old 11-09-2012, 03:16 PM   PM User | #16
Ace.....
New Coder

 
Join Date: Nov 2012
Location: France
Posts: 78
Thanks: 20
Thanked 0 Times in 0 Posts
Ace..... is an unknown quantity at this point
Quote:
Originally Posted by Ace..... View Post
The good news is that the system now only requires the removal of one "onClick" event handler.
Hang on.... I'll answer your last post with another.

The onkeyup code is working very well, in transferring the text to its designated division (then onward to google and therefore returning translated to the same designated area).

The problem now is: how to pass the translated text back to google?

The requirement being; that the user should only be interested in typing the text.
The onkeyup deals with that perfectly, for the first translation.

What is needed is a way to fire a script, when the translation has arrived.
I'm doing this with onclick, just to prove that everything is working fine.
And it is.

As an alternative I note lines 173 to 176 ( http://pastebin.com/016QNsSz )

Code:
[3726:3754:5520733244:VERBOSE1:resource_loader.cc(293)] OnResponseStarted: http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit
[3726:3754:5520734105:VERBOSE1:resource_loader.cc(320)] OnReadCompleted: "http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" bytes_read = 1477
[3726:3754:5520734658:VERBOSE1:resource_loader.cc(320)] OnReadCompleted: "http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" bytes_read = 0
[3726:3754:5520734707:VERBOSE1:resource_loader.cc(543)] ResponseCompleted: http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit
Could "ResponseCompleted" be the code element that could fire the script to pass the translated text back to google?

Here is how I'm doing it, just to prove the text can be re-translated and passed into a 2nd iframe:

Code:
<div id="google_translate_element"></div> 
<div id="thetext" onClick="translateIt(document.body.innerText)"></div>

<script type="text/javascript"> 
function translateIt(text) { parent.window.frames['theframe2'].googleTranslateElementInit(text); } 
</script>
I guess I can be a bit more accurate with the text value, but as it stands, with a click on the text, the 2nd translation occurs.
Ace..... is offline   Reply With Quote