I believe the problem is associated with javascript memory.
The New Setup
I removed oninput, and replaced it with a shortcut to transfer text for translation.
I re-introduced checkit (4000ms), to confirm translation had taken place, before sending the translated text for reverse translation.
This slowed everything down, allowing for better examination.
I soon discovered that what we thought was happening was not (
thanks to chrome console).
Comparing script commands with ACTUAL output
1st Pass:
I've pasted a largish sized chunk of text for editing (value).
Code:
shortcut.add("Ctrl+Alt",function grabmytext() {translateIt(document.getElementById('styled').value);});
function translateIt(text) {parent.frames['theframe'].googleTranslateElementInit(text);}
The first time this is run, it performs as planned: The value is passed, is written in (English), translated (French).
Similarly, for the reverse translation, the first time run, everything is passed, to be written in (French), translated (English).
However, a different set of rules apply, and function correctly, until grinding to a halt.
By examining Network - Headers:
The text is divided by line breaks ( the divider is q: ).
The record shows it being sent like this in English; but we have no record of the return translation.
The next header shows it being sent like this in French ( line by line, separated by q: )
2nd Pass:
I choose a line of text to edit.
I send (according to my scripts), the entire text (value), and I see it appear in English, then watch it turning to French.
In my other frame, I watch the process in reverse.
However, when I check Network - Headers:
The only text that I have sent, is the line of text that I have edited!
The next header shows the same line in French being sent for re-translation.
Thereafter.... every time I send the text for translation, only the line, or the lines, that I've edited are sent.
How the hell is it managing all this?
Where is all this information being stored?
It first must be storing the (value), and then storing the French translation, plus the individual line links, between the (value) and the French, cos you can hover over a French line, and read its original English.
It must then be storing another copy of the French and the reverse translation with its links, cos you can hover over the English and read the original French.
WOW!
From its perspective I got 28 edits.
From my perspective I got 14 edits.
It then ground to a halt.
The only way forward, is to select & copy all the text, then reload, and paste in the text, and start editing from where you left off.
Solutions?
Is it possible to flush the memory without reloading, and re-read the scripts etc?
Effectively: the text value would be sent as virgin text (like the very first time)
BTW I'm assuming this IS a mem problem, because it certainly clears on reload.