View Single Post
Old 11-09-2012, 03:54 PM   PM User | #17
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 xelawho View Post
can I ask what the purpose of the other iframe is? it seems to want to translate to English? But if the input language is English what is the idea? and why not fire the function on the onkeyup of the textarea the way you do with the first iframe?
The idea is simply to gain feedback.
Google doesn't translate textarea content, hence why we must first send it to be written in to the page, in order for it to be read.

Quote:
Originally Posted by xelawho View Post
also, this is going to cause you problems:
Code:
<body onhaschange="translateIt(document.body.innerText)">
there is, sadly, I believe, no body onhaschange event, and the equivalent is hard to implement in a cross-browser fashion.
Yes, I should have deleted that..... I was merely floundering around looking to see if there was an event handler that would work..... and there were none.

Quote:
Originally Posted by xelawho View Post
innerText will get you into trouble, too. innerText is IE only. textContent is more widely accepted, but IE only started recognising it at IE9+

if you are only looking to translate the text from the textarea, it is much easier just to be getting the value of that textarea, the same as you are doing now.
All fair comment.
This whole area of standardisation is in a mess, and should have been sorted out some years back (considering the dates of some of the articles I've read, discussing this very issue).

My thinking with this thread, was to focus on establishing the scripts that could pass either the text or dom elements, to and from google.
In effect treating the two problems separately.

On the question of "what to transfer":

Logic Ali produced a very good piece of coding to operate in this area:
http://www.codingforums.com/showpost...06&postcount=6

Here is another interesting behemoth, apparently working across all browsers.
http://clubajax.org/examples/plain-t...-vs-innertext/

I stopped working on this issue, when I discovered there were problems working with line breaks, as the text moved backwards and forwards.

I figured that once I had a working system in place, I could then experiment with greater ease.

But clearly crossbrowser/generation compatibility is a nightmare, that hopefully can be dealt with, with community assistance coming from:
http://www.codingforums.com/showthread.php?t=280694
Ace..... is offline   Reply With Quote