android - set turkish language for text to speech -


this question has answer here:

im working on text speech app , want set turkish language this:

tts.setlanguage(locale.tr); 

but not available in android , wrong add way or there different way add turkish language text speech .

any , advice appreciated

text speech code :

 public class androidtexttospeechactivity extends activity implements     texttospeech.oninitlistener { /** called when activity first created. */  private texttospeech tts; private button btnspeak; private edittext txttext;  @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);      tts = new texttospeech(this, this);      btnspeak = (button) findviewbyid(r.id.btnspeak);      txttext = (edittext) findviewbyid(r.id.txttext);      // button on click event     btnspeak.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view arg0) {             speakout();}                          });} @override public void ondestroy() {     // don't forget shutdown!     if (tts != null) {         tts.stop();         tts.shutdown();}      super.ondestroy();}  @override public void oninit(int status) {     // todo auto-generated method stub      if (status == texttospeech.success) {          int result = tts.setlanguage(locale.us);          // tts.setpitch(5); // set pitch level          // tts.setspeechrate(2); // set speech speed rate          if (result == texttospeech.lang_missing_data             || result == texttospeech.lang_not_supported) {             log.e("tts", "language not supported");         } else {             btnspeak.setenabled(true);             speakout();}         } else {             log.e("tts", "initilization failed");}}   private void speakout() {      string text = txttext.gettext().tostring();      tts.speak(text, texttospeech.queue_flush, null);}} 

if device turkish, use :

tts.setlanguage(locale.getdefault()); 

instead of

int result = tts.setlanguage(locale.us); 

then extra_language_model value must be: "tr-tr".

i tried , succeeded.(but downloaded turkish lang.pack samsung market)


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -