Some time later I discovered bookmarklets. I liked the approach and made one for myself.
Drag this link En<>Ru the bookmark panel to be able translate words or text.
To change default source and destination languages put their codes in place of en and ru.
Source code.
(function() {
var t;
try {
t= ((window.getSelection && window.getSelection()) ||
(document.getSelection && document.getSelection()) ||
(document.selection &&
document.selection.createRange &&
document.selection.createRange().text));
}
catch(e){
t = "";
}
if(t && (t=t.toString()) && t.length){
window.open("http://translate.google.com/?sl=en&tl=ru&hl=en&text="+t+"#en|ru|"+t);
}
})()
I used Javascript Compressor to get compressed version to use it in the bookmarklet.
How do I use this same bookmarklet only for spanish translation into english
ReplyDeleteYou should change link in code to "http://www.google.com/dictionary?aq=f&langpair=es|en&q="+t.
ReplyDeleteAnd don't forget to obfuscate new code for bookmarklet.