javaandroidgoogle-speech-apichinese-localegoogle-voice-search

Google speech recognizer for Traditional Chinese text


I want to output the speech to traditional chinese but it output to simplify chinese instead. My codes:

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "zh-TW");

I also tried to set EXTRA_LANGUAGE to "zh_TW", "TW" and Locale.TAIWAN but it doesn't work too.

In my Android 7.0 settings "Traditional Chinese"(繁體中文) is added in Language preferences. I able to select it in keyboard & type it.

Is this a bug of google speech recognizer?


Solution

  • Finally I found the solution, need to use cmn-Hant-TW for EXTRA_LANGUAGE. Google documentation is sucks.