Hi guys, first post here! Expo and React Native are simply incredible! I’m been programming it for a month now and finished my first app.
I’m from Brazil and I noticed that the function speak from speech is reading the text in a wrong language. Even when I set it to “pt-BR”, which is portuguese from Brazil, it reads “pt-PT”, which is portuguese from Portugal.
The problem only happens on Android. On iOS it speaks correctly. Here is the code:
let text = 'Oi, tudo bem? Estou lendo em português.';
Speech.speak (text, {
language: 'pt-BR',
});
Is this language not avaiable and it defaults to pt-PT ? If not, is there an alternative from Speech without detaching it that works with Expo? I tried a few others alternatives from both Speech and Audio, but none worked.
The value pt-BR should work as it is a valid value from BCP 47. I’ve brought this up internally and we’ll investigate what could be happening and get back to you.
Hi @marcoblbr - this is most likely because the device does not support the pt-BR Locale or have TextToSpeech data for it. Therefore the Speech API falls back to the device’s default locale/language of pt-PT. Unfortunately I’m not aware of any alternative for text-to-speech that will work without detaching from Expo You could see if you can install support for the pt-BR language directly onto your device, but I can’t guarantee that will work.
Thanks for your feedback and return on this issue. I read your answers and double checked my device settings. I tested on a Samsung tablet and on the settings, the Samsung Text-to-Speech Engine was enabled with pt-BR as well.
But then I changed to Google Text-to-Speech Engine and portuguese for Brazil was enabled and that fixed the issue.
So, it was not a problem of Expo. It was maybe a bug with Samsung TTS engine.