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

Reimplement tree walker #64

Closed jelmervdl closed 1 year ago

jelmervdl commented 1 year ago

Reimplement tree walker to deal with elements explicitly marked for translation.

This adds support for using <div class="translate"> inside a <body class="notranslate"> like some React sides do to work around Google Translate issues. This resolves #60.

jelmervdl commented 1 year ago

Tested it on a recent Mastodon instance (not logged in, but with toots in multiple languages). It translates the toots (that are in the selected source language only) and does restore them correctly when you click "show origin".