Hacker News new | ask | show | jobs
by hnben 1020 days ago
highlight a string on a website, then click this to translate with google

        javascript:(function() { const baseUrl = "https://translate.google.com/?op=translate&sl=auto&tl=de&text="; const textRaw = window.getSelection(); const text = encodeURIComponent(textRaw); console.log("selected text: ", text, textRaw); window.open(baseUrl + text) })();

(maybe adjust the target language in the url)
1 comments

Cool!

I feel like there should be something like a bookmarklet store, similar to the extensions, or userscripts, right?

yes!

If you find one, please let me know