The app I am building requires me to speak out loud, using the inbuilt TextToSpeech algorithm, a random string from almost any language without using the Internet. I am not sure how to go about this.
Below is what I have so far, but it does not work with languages which are not similar to English, e.g. Chinese. I believe this is due to the Locale that is set to US.
t1=new TextToSpeech(context, new TextToSpeech.OnInitListener() {
            @Override
            public void onInit(int status) {
                if(status != TextToSpeech.ERROR) {
                    t1.setLanguage(Locale.US); // TODO: 22/09/2015 FIX LOCALE FOR TextToSpeech
                    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                        /** creates a high quality voice when on Lollipop or better android version */
                        Voice voice = new Voice("voice", Locale.US, Voice.QUALITY_VERY_HIGH, Voice.LATENCY_NORMAL, false, null);
                        t1.setVoice(voice);
                    }
                }
            }
        });
        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                TextView tv = (TextView) v.findViewById(R.id.to_language);
                String toSpeak = tv.getText().toString();
                if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    t1.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null, v.getTag().toString());
                    t1.setOnUtteranceProgressListener(new UtteranceProgressListener() {
                        @Override
                        public void onStart(String utteranceId) {
                           //tv.setTextColor(Color.parseColor("#57d801"));
                        }
                        @Override
                        public void onDone(String utteranceId) {
                            //tv.setTextColor(Color.parseColor("#FFFFFF"));
                        }
                        @Override
                        public void onError(String utteranceId) {
                        }
                    });
                } else {
                    t1.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);
                    t1.setOnUtteranceCompletedListener(new TextToSpeech.OnUtteranceCompletedListener() {
                        @Override
                        public void onUtteranceCompleted(String utteranceId) {
                        }
                    });
                }
            }
        });
If anyone could point me in the right direction for a solution to my problem it would be greatly appreciated.
