I am making an language app that needs audio as well as visual translations. I thought of using Google Translate API, but according to this SO post, it appears that "The explanation is that Google restricts the usage of this service."
But this SO post, Google Text-To-Speech API, says I can use tl
and q
params, like http://translate.google.com/translate_tts?tl=zh-CN&q=Hello
to return audio. This gives me a weird transliteration in Chinese of "Hello", which says "Ha Low" instead of "Ni Hao".
The user also states that "it will automatically generate a wav file which you can easily get with an HTTP request". When I GET
using jsonp
(need to use this because $.get()
or non-jsonp requests have origin blocked) I get the following unreadable error:
Code:
var theApp = angular.module('myApp', []);
theApp.controller('APICtrl', ['$scope', '$http',
function($scope, $http) {
var httpRequest = "http://translate.google.com/translate_tts?tl=" + "zh-CN" + "&q=" + "Hello";
$http.jsonp(httpRequest)
.success(function(data) {
console.log(data);
}
);
}
]);
So my question is... is there a standard endpoint for Google translate API to access audio files? If not, what is a good way to do this that works?