-
Notifications
You must be signed in to change notification settings - Fork 48
Translate Selected Text #358
Comments
Another user requests this here: https://news.ycombinator.com/item?id=31598074 |
Another HN user mentioned this extension which has such a user interface. It might be tricky to do well with the current translation models: I'd expect users will select a single word, or just a couple of words, not a full sentence. IIRC the training data used for the current translation models don't have much of that kind of input. It should be doable to augment the training data to add it, but it does entail retraining models. |
I'd love something like this. For my use-case, it doesn't have to replace the text in the DOM either. Popping a modal or new tab is perfectly fine. Presently, I've been using this add-on, which adds entries to the right-click context menu (as well as keyboard shortcuts/bindings) for sending selected text to Google Translate. Also, my use-case involves translating entire posts across the fediverse, which can be anything from dozens to hundreds of words long (so typically, at least a few sentences, and not just a couple words). I have only a so-so grip on the Spanish language, and popping those posts into Google Translate to make sure I interpreted them accurately is quite helpful. |
I second @aggroskater comment and use the same extension currently. Most of the time I only need parts of the webpage translated (usually if I'm not sure about my own translation or it's something like a fediverse with really mixed bag of languages). I virtually never use whole page translation (most of the pages I need are either in my native tongue or English) |
@woj-tek in that case, would you also like it to be able to select/auto-detect the language of just the selection? Right now the add-on only identifies the language of the page, assuming its just all in the same language. And would you mostly want to translate that then to the same output language (e.g. the same language as your Browser is using, like the add-on assumes right now)? |
@jelmervdl I think something along the lines of:
As for the target language - I think it should be configurable but translating to browser language should be enough I think (sometimes I set my OS and thus browser to Spanish for immersion though when reading something online and trying to understand it better I would prefer to have it translated to English [still not my native but I think machine translation to to English would be better than to Polish :) ]). |
Maybe do too much and throw some away, then optimize. Consider this straw proposal starting point: User highlights a portion of text. We insert a non-functional custom markup tag around the highlight. It might look like: <p>He heard the voice say, "<bergamot-translation-tag>El tiempo para su trabajo ha sido concedido</bergamot-translation-tag>.</p> Then we walk the tree and chunk it like normal (or we get clever and only chunk until we queue a chunk with the closing tag, since that's all the context the engine would get anyhow. something like that). When the translated text is returned, instead of inserting it into the page we grab the inner text of the fake element and present that to the user or replace the fake tag contents with it. Finally, remove the fake tags from the page. I'm probably missing a bunch of edge cases, here. For example, maybe we need to consider non-contiguous highlighting for some platform. How this is presented to the user is also critical. Translation in place seems to match what we already do but there are other options to consider, like a modal window injected into the page would also provide a convenient place for selecting the language. |
In https://github.com/jelmervdl/firefox-translations I've implemented a basic version of this, which just shows a popup of the translated text you selected. It assumes the text is in the same language as the rest of the page. In theory, in my implementation, you can change the from/to language via the translate button popup in the browser UI, but that's unintuitive. @lonnen oooh I like the idea of expanding the selection to also capture some context! |
Thanks. No matter how we incorporate short strings into the training, the translation should always work a little better with some context to disambiguate words with multiple meanings |
This is a must-have. This open-source addon translates the selected text: https://simple-translate.sienori.com/ |
Also want to add a potentially positive use case of such feature request. I'm currently learning a language, and it would be very handy to read the page in its original language, and only highlight the words, sentences and paragraphs that I am not sure about. |
I would love that for messengers like Element (where web page translation currently doesn't work). This would help translate messages in international chats a lot. |
This would be great, especially for fediverse and twitter. Functionality-wise I really like this add-on (disclaimer i am in no way related to the author). I do not know what's its backend, but at the front it seems to work fantastically: select text, select item in right click menu and it shows a in-page pop-up overlay box. It also does not require any permissions. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@kpu my bad, thanks for mentioning! I (vaguely) remembered this, but did not think when google landed me here. Will lurk in that repo. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
What is also surprising is that it does add Chrome support together with manifest v3, which I recall Mozilla was strongly against. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This was also recently requested on Mozilla Connect: https://connect.mozilla.org/t5/ideas/translate-addon-highlight-to-translate/idi-p/20759 |
My ideal flow would be:
It should probably remember the source/target language if overridden while on the same web page, but do langid if the user has navigated to a different page (just remembering target language), though having the above parts 1-4 are the most important. |
It seems like it's been several months since this was added into the add-on, but I only recently noticed it. And I just have to say... thank y'all so very much! The ability to select text, right-click, and hit "translate with Firefox Translations" is exactly the sort of thing I was looking for. I no longer have to send data to Google, I no longer have to pop into a new tab, I can translate just pieces of the page in my fediverse feeds... awesome :D @andrenatal and team |
We're glad to help @aggroskater. |
I'd absolutely love it if I could highlight some text on a page, right click and translate it (see the translation and have that added to my pastebuffer when I click on it. Ideally, this would work both ways, to and from English/the system language.
The text was updated successfully, but these errors were encountered: