Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lang code en-US,en-AU not working with getAudioBase64, getAllAudioBase64 #45

Open
1sharth opened this issue Feb 13, 2021 · 2 comments
Open

Comments

@1sharth
Copy link

1sharth commented Feb 13, 2021

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.

@SuspiciousLookingOwl
Copy link

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
image

With exception for Chinese Simplified and Traditional (zh-CN and zh-TW respectively)

@zlargon
Copy link
Owner

zlargon commented Mar 20, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants