q

14 views
Skip to first unread message

Stefan Grozdanovski

unread,
Feb 3, 2012, 1:41:47 PM2/3/12
to mozilla-labs-jetpack
I have a problem, my add-on(code) is not working, what is the
problem in this code ?
-------------------------------------------------
exports.main = function() {

var contextMenu = require('context-menu');
var request = require('request');
var selection = require('selection')

var menuItem = contextMenu.Item({
label: "Translate Selection",
context: contextMenu.SelectionContext()
,
contentScript: 'self.on("click", function () {' +
'var text =
window.getSelection().toString();' +
'self.postMessage(text);' +
'});',
onMessage: function (text) {
if (text.length === 0) {
throw ('Text to translate must not be empty');
}

var req = request.Request{
url: "http://ajax.googleapis.com/ajax/services/
language/translate",
content: (
v: "1.0",
q: text,
langpair: "|en"
},
onComplete: function (response) {
translated =
response.json.responseData.translatedText;
selection.text = translated;
}
});

req.get();
}
});
};
----------------------

Wes Kocher

unread,
Feb 3, 2012, 2:12:36 PM2/3/12
to mozilla-la...@googlegroups.com
I was under the impression that Google discontinued their translation API.


--
You received this message because you are subscribed to the Google Groups "mozilla-labs-jetpack" group.
To post to this group, send email to mozilla-la...@googlegroups.com.
To unsubscribe from this group, send email to mozilla-labs-jet...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mozilla-labs-jetpack?hl=en.


Atul jangra

unread,
Feb 4, 2012, 4:53:17 AM2/4/12
to mozilla-la...@googlegroups.com
Yes , Google Translation was discontinued by Google.
Google Translate API v2 is now available as a paid service only, and the number of requests your application can make per day is limited. As of December 1, 2011, Google Translate API v1 is no longer available; it was officially deprecated on May 26, 2011.  
Regards 
--
Atul jangra
Computer Science and Engineering
Indian Institute of Technology ,Delhi

Reply all
Reply to author
Forward
0 new messages