21, నవంబర్ 2008, శుక్రవారం

Ubiquity code for telugu dictionary

నేను ubiquity (firefox) తో తెలుగు dictionary కోసం ఒక కోడ్ రాసుంచాను. Copy the following code into the Ubiquity Command Editor.

// === CODE START ===

CmdUtils.CreateCommand({
name: "brown",
icon: "http://example.com/example.png",
homepage: "http://dsal.uchicago.edu/dictionaries/brown/",
author: { name: "Pradeep", email: "asd"},
license: "GPL",
description: "Search for telugu words in Brown dictionary",
help: "brown ",
takes: {"input": noun_arb_text},
preview: function( pblock, input ) {
var url = "http://dsal.uchicago.edu/cgi-bin/romadict.pl?query=" + input.text + "&table=brown"
//var template = "Hello ${name}";
//pblock.innerHTML = CmdUtils.renderTemplate(template, {"name": "World!"});
jQuery.get( url, {}, function(dataInURL)
{
pblock.innerHTML = dataInURL;
})
},
execute: function(input) {
var url = "http://dsal.uchicago.edu/cgi-bin/romadict.pl?query=" + input.text + "&table=brown"
Utils.openUrlInBrowser(url);
//CmdUtils.setSelection("You selected: "+input.html);
}
});

// === CODE ENDS ===

Press CTRL+SPACE (or your own hot-key) and type "brown any_telugu_word"
You will get the meaning of the word if it is there in Brown dictionary.

I don't know whether I can use the site "http://dsal.uchicago.edu/dictionaries/brown/" as it is. The ubiquity code will dump all the content of the webpage.
Have to see how to change it .. may be in future versions... ;)

ఒక వేళ పైన ఇచ్చిన siteలో XML support ఉంటే, ఈ codeను ఇంకొంచెం బాగా రాయొచ్చేమో అనిపించింది. నాకు ubiquity ద్వారా తెలుగు dictionary కావాలి. పైన ఉన్న కోడ్ కన్నా బాగున్న కోడ్ ఉంటే, అందజేయగలరు.

నేను పై కోడ్‌ను firefox with Windows XP మీద ట్రై చేశాను. బానే పని చేసింది. You can also try.. :)

Thanks.

కామెంట్‌లు లేవు:

కామెంట్‌ను పోస్ట్ చేయండి