I am making a language learning web app that when you hover over the word, it pronounces it for you. I'd like to access the native speaker translations from Google Translate API.
I've found this resource which gives http://translate.google.com/translate_tts
as the base URL and tl
for target language and q
for the query string.
This works awesome when I just access it in the browser, http://translate.google.com/translate_tts?tl=zh-CN&q=你好, but any httprequests for my app return a 403 Forbidden error.
localhost:~ me$ wget "http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=hello+world" --2015-06-02 11:02:06-- http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=hello+world Resolving translate.google.com... 173.194.123.38, 173.194.123.36, 173.194.123.32, ... Connecting to translate.google.com|173.194.123.38|:80... connected. HTTP request sent, awaiting response... 403 Forbidden 2015-06-02 11:02:07 ERROR 403: Forbidden.
Is there a formal Google API for text-to-speech associated with their payment plans for traditional Google Translate API that I'm just not finding? Or is there a way to get
and play this audio somehow?
Google Translate API also has a default limit of 2 million characters per day and 100,000 characters per 100 second. The former can be increased up to 50 million characters per day.
The Google Translate API is not free. Its pricing is based off monthly usage in terms of millions of characters. It costs $20 per 1 million characters for translation or language detection. Price is per character sent to the API for processing, including whitespace characters.
Google Translate is still available for very narrow purposes and use cases. Specifically, to quote Google's official resource: [The website widget can be used by] government, non-profit, and/or non-commercial websites (for example, academic institutions) that focus on COVID-19 response.
You can get anything sound, I found it: https://translate.google.com.vn/translate_tts?ie=UTF-8&q=ANYTHING_TEXT&tl=en&client=tw-ob Note: client=tw-ob
That resource is dated. Google deprecated free access to the language translate api. Now an API key is needed. The api is also now in V2.
Without an api key you will receive the 403 forbidden error.
More information here: https://cloud.google.com/translate/docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With