jelmervdl / translatelocally-web-ext

TranslateLocally for the Browser is a web-extension that enables client side in-page translations for web browsers.
https://addons.mozilla.org/en-GB/firefox/addon/translatelocally-for-firefox/
Mozilla Public License 2.0
65 stars 3 forks source link

Outbound translation #42

Closed jelmervdl closed 1 year ago

jelmervdl commented 1 year ago

Mozilla's version has it, and many (like… 2) of the users of that extension that I talked to (like… 3?) liked the feature a lot.

Personally not sure about the UI/UX that Mozilla's version has here… but the users I asked said it worked well for them and they didn't know about a better way.

I'm tempted to wait on #41 because that comes with a latency optimised queue.

jelmervdl commented 1 year ago

Say a page is in German, and I translate it to English. If I fill in a form, I will be typing in English and it will be translated to German. There will be a German to English backtranslation to confirm how my typed text was translated.

The DE -> EN translation of the page will be using the batch translator running in the background script. The EN -> DE translation of the form could be using the latency optimised translator running in the page itself using buffers from the background script so they're cached outside of the domain of the site?

DE->EN backtranslation could happen with the batch translator in the background script, called through the same mechanics as the latency optimised translator (i.e. only ever submit a translation after the previous is done, never queueing irrelevant translations). Then we don't have to load a second engine with the same model but it might be less responsive. (Which it already is because it has to wait for the EN->DE translation anyway)

UI: Firefox pops up a secondary UI in which you type your input. It shows the backtranslation next to it. The translation is constantly shown in the text field.

UI: You'd type untranslated text in the original field, and a popup below or on the side of the field shows a preview of the translation and a backtranslation. You can press an [ACCEPT] button to copy over the translation into the original field.

What about when you edit a text field? I.e. it already has some text in there in the original language. Ideally the text box where you type in English will have a translated version of that original text as well to help you edit. Even further, we could store those initial translations in reverse in the translation cache which would force it to translate these sentences back to the original text as they appeared (and not some paraphrasing of it because of the original->english->original dance)

jelmervdl commented 1 year ago

Maybe relevant documentation about layout and visual viewport measurements. I don't think they differ on desktop, unless you're working on a windows tablet or something that has a pop-up keyboard?