I want to set Dutch Language in my TTS object. Following is the code,
@Override
public void onInit(int status)
{
if ( status == TextToSpeech.SUCCESS )
{
int result = tts.setLanguage(Locale.getDefault());
System.out.println ( "Result : " + result + " " + Locale.getDefault().getLanguage() );
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED)
{
Toast.makeText( this , "Please Set your Language to English US.", Toast.LENGTH_LONG ).show();
}
else
{
tts.speak( "Hoe gaat het",TextToSpeech.QUEUE_FLUSH, null );
}
}
}
Following line sets the language in TTS
int result = tts.setLanguage(Locale.getDefault());
Available Locale's in Locale.
Now if my Phone's Language's is Dutch then I am able to set TTS's language as Dutch Language, but if My Phone's Language is not dutch ( for e.g. if it is English ) then there is no option to set the TTS's language as Dutch.
Can anybody help me to set the Dutch language in TTS?
This should work
int result = tts.setLanguage(new Locale("nl_NL"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With