How to set Cantonese as the voice search language

2020-04-20 12:12发布

问题:

My current code below works fine when using the "ZH" ISO code for Mandarin but won't for Cantonese. This is the code below

  Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
  String myLanguage= "yue";
   i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, myLanguage);
   i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, myLanguage); 
   i.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, myLanguage);

回答1:

I got the code working, the dash just needed replaced with a underscore to make:

zh_HK

Thanks for your help Lilz.



回答2:

For Cantonese try zh-HK instead

Hope this helps



标签: java android iso