Yandex translator und texttospeech

I want to create an translation app from german to croatian.
The translation will work but when I want to use texttospeech the spoken croation text is not correct.
Therefore I hope somebody can help me there with the code.
Here my example:

kindly regards

You need to set the TextToSpeech language to Croatian.

I am not sure Croatian is one of the possible TTS languages.

See Let me know the language and country codes of the google TTS for advice. Try hr or hrv .

Thanks for your answer but hr or hrv doesn't work.

OK. I did some experimenting that might help you.

Users should be able to change their device TTS language using Android Settings.

On an Android 8 this is Settings>General Management>Language & Input>Speech>Use system language>Croatian . For example two screens you might see:

The TextToSpeech component can let you know which languages should/may be available on your device.

HRV should be the country; hr should be the language. HRV for Hrvatski (Croatian)

Some possible example code:


The code in Button5 and Button7 fail. The app does not like hr. I do not know why.
Perhaps this stuff will work on your device?

The TTS component documentation 'says' " Country is code to use for speech generation. This can affect the pronunciation. For example, British English (GBR) will sound different from US English (USA). Not every country code will affect every language. :cry:

Thanks a lot for your answer.
I have tried different settings and also I change my phone to croatian language but the texttospeech doesn't work.
kindly regards