google-tts
google-tts copied to clipboard
lang code en-US,en-AU not working with getAudioBase64, getAllAudioBase64
The sample code present in the examples is not working:
// get base64 text
googleTTS.getAudioBase64('Hello World', {
lang: 'en-US',
slow: false,
host: 'https://translate.google.com',
timeout: 10000,
})
.then(console.log) // base64 text
.catch(console.error);
Error: lang "en-US" might not exist
It successfully returned base64 output for language codes: 'en', 'es'. en-Us, en-AU are working fine for getAudioUrl,getAllAudioUrls functions though.
Seems like this is an expected behavior, when sending a request to the endpoint to get the base64 data, we only sends 2 characters country code
With exception for Chinese Simplified and Traditional (zh-CN
and zh-TW
respectively)
Thank you for reporting this issue.
Looks like google translate API has a minor change. I will some updates next release.
- change the default language to
en
- [typescript] remove the language types since the API doesn't fully follow the document
Thanks