2

I cannot find Locale.IN in Android, like Locale.UK, Locale.US.

Where could I find it?

Arnaud
  • 7,259
  • 10
  • 50
  • 71

4 Answers4

5

You can use Locale locale = new Locale("en", "IN"); to set English India for the TTS.

Locale locale = new Locale("en", "IN");
int availability = mTTSObject.isLanguageAvailable(locale);
switch (availability) {
    case TextToSpeech.LANG_NOT_SUPPORTED: {
        mTTSObject.setLanguage(Locale.US);
        break;
    }
    case TextToSpeech.LANG_MISSING_DATA: {
        mTTSObject.setLanguage(Locale.US);
        break;
    }
    case TextToSpeech.LANG_AVAILABLE: {
        mTTSObject.setLanguage(Locale.US);
        break;
    }
    case TextToSpeech.LANG_COUNTRY_AVAILABLE:
    case TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE: {
        mTTSObject.setLanguage(locale);
        break;
    }
}
Ravi Sisodia
  • 776
  • 1
  • 5
  • 20
0

Locale.ENGLISH is available in Locale class

Ashish Agrawal
  • 1,977
  • 2
  • 18
  • 32
0

Please refer to the list of Locale available in android specified here. In India either we speak UK based English or US based English. there is no such Indian accent in English. Generally we speak UK based English.

Community
  • 1
  • 1
Abhinav Singh Maurya
  • 3,313
  • 8
  • 33
  • 51
0

I am not Indian, but if you set the language to Locale("hi", "IN") and let the tts speak English phrases they pretty much sound like the way my Indian friends speak. Might not be a perfect Indian accent you are looking for but close enough I think. Similarly if you want to put some "french accent" set the language to Locale("fr", "FR") and and let it speak English phrases.

John Tesh
  • 11
  • 1