Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use it - it supports only english #5

Open
superzebra2 opened this issue May 13, 2019 · 3 comments
Open

Don't use it - it supports only english #5

superzebra2 opened this issue May 13, 2019 · 3 comments

Comments

@superzebra2
Copy link

and i was trying to modify libs to add support of multi language for tts and voice recognition - but it is hard

@hiteshsahu
Copy link
Owner

hiteshsahu commented May 15, 2019

Change language in intent,


class SpeechToTextConverter(private val conversionCallback: ConversionCallback)  : TranslatorFactory.IConverter {
    private   val  TAG = SpeechToTextConverter::class.java.name
    override fun initialize(message: String, appContext: Activity): SpeechToTextConverter {
        val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault())

example for chinease

intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "zh-cmn");

@hiteshsahu
Copy link
Owner

hiteshsahu commented May 15, 2019

For Text to speech

Replace

textToSpeech!!.language = Locale.getDefault()

in


override fun initialize(message: String, appContext: Activity): TranslatorFactory.IConverter {
       textToSpeech = TextToSpeech(appContext, TextToSpeech.OnInitListener { status ->
           if (status != TextToSpeech.ERROR) {
               textToSpeech!!.language = Locale.getDefault()

with your local example chinese:

textToSpeech!!.language =new Locale("zh-cmn");

@ahmedbilal205
Copy link

what if we want to change languages at runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants