Change TTS language in android studio

Viewed 14

I tried to install another language, but it doesn't work

val loc = Locale("by", "BLR")

    textToSpeech = TextToSpeech(this) { status ->

        if (status == TextToSpeech.SUCCESS) {
            val result: Int = textToSpeech.setLanguage(loc)

            if (result == TextToSpeech.LANG_MISSING_DATA ||
                result == TextToSpeech.LANG_NOT_SUPPORTED
            ) {
                Log.e(logtts, "Language not supported")
            } else {
                Log.e(logtts, "Language supported")
            }
        } else {
            Log.e(logtts, "Initialization failed")
        }
    }

Is there a way to change the language?

0 Answers
Related