Skip to content

Instantly share code, notes, and snippets.

@dextergk
Created April 3, 2011 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dextergk/900875 to your computer and use it in GitHub Desktop.
Save dextergk/900875 to your computer and use it in GitHub Desktop.
/* Translating a webpage to english using google translate. */
CmdUtils.CreateCommand({
names: ["GTranslate"],
icon: "http://www.google.com/images/icons/illustrations/translate_search-lb80.png",
arguments: [{role: "object", nountype: noun_arb_text, label: "URL to translate"}],
description: "Translating a webpage to english using google translate.",
help: "<i>Select the url and press enter</i>.",
author: {name: "DexterGk", email: "dextergk@gmail.com"},
license: "GPL",
homepage: "http://dextergk.blogspot.com/",
preview: function preview(pblock,args) {
pblock.innerHTML = this.help;
},
execute: function(args) {
Utils.openUrlInBrowser("http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=auto&tl=en&u="+args.object.text);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment