November 2nd, 2012, 06:14 AM
Access Google translated text as a variable
I'm creating a 3 box translation system: source text-->translated text-->source language
This will allow English to be entered. The French translation (next to it). The French translated back into English (next to it).
This would be the ultimate google translator as the writer could check his French (any) translation by reading it in English (as he types it!!); avoiding stupid translation errors.
BTW this works well as a concept, but is extremely laborious, involving copy and paste across 2 tabs for every change made (ie. not as it is typed).
This could be done any way, to get the end result.
I'm currently developing it with 3 iframes, using the function below (onclick), to store the source text.
And this script to write it into page 2, where it will be auto-translated.
var pg_1 = document.getElementById("textarea_id").value;
I now need to get the translated displayed text written into page 3.
document.getElementById("result").innerHTML="<pre>" + localStorage.pg_1_text + "</pre>";
Evidently I can drag the mouse across the text, copy and paste into page 3. However, an onclick system would be better. Write a paragraph, click on each page, view the results..... that'd be fine.
My problem is that I don't know how this 'displayed text' is referenced. But however it is, the priority is to get the displayed text into page 3.
(Note: I have had a read of similar threads and none seem to be applicable)