Hi folks,
I may be doing something really stupid here, but can't for the life of me figure out why I keep getting a 404 / Not Found response when calling the language.translations.list service of the Translate API. Any tips would be appreciated. Here is the relevant code:
function translateButtonClick() {
gapi.client.load('translate', 'v2', function() {
var request = gapi.client.language.translations.list({
'q': document.getElementById('source').value,
'source': 'en',
'target': 'fr'
});
request.execute(function(response) {
console.log(request);
console.log(response);
var results = document.getElementById('results');
results.innerHTML = response.data.translations[0].translatedText;
});
});
}
I can see in the console that the script is successfully getting into the execute callback, but the response has a 404 error and the script actually fails because response.data.translations is undefined.
Thanks,
Brian