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

Original text popup #65

Open jelmervdl opened 1 year ago

jelmervdl commented 1 year ago

Implement #5 by getting the original text from the "restore page" feature.

It doesn't have information about sentence ends, so currently generates a popup the size of the translated DOM node (or "chunk")

jelmervdl commented 1 year ago
image

Doesn't work all that well without sentence boundaries unfortunately.

Intl.Segmenter exists but I don't want to have two sentence splitters inside the project, with the chance that they go out of sync and its unable to map the correct sentence to the correct translated sentence :/

jelmervdl commented 1 year ago

For simple content it works quite well though:

image