Programmatically changing recognizerintent to recognize a language other than English not working

StackOverflow https://stackoverflow.com/questions/21667938

  •  09-10-2022
  •  | 
  •  

Question

I tried both of these ways and the google voice web search is still only recognizing English.

Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "ja-JP");
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "ja-JP");
Était-ce utile?

La solution

Try

Intent i = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "ja-JP");  

Autres conseils

Try

String lang_code = "ja-JP";

Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, lang_code);
i.putExtra(RecognizerIntent.EXTRA_PROMPT,"Hi speak something");
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top