An Android app running API > 21 utilizes the framework TextToSpeech class. The tts engine is set as com.google.android.tts.
All the available locales in the engine can be obtained with,
Set<Locale> engineLocales = mTts.getAvailableLanguages();
and,
String displayLanguage = locale.getDisplayLanguage();
creates a nice user-facing string "English, Chinese, Spanish, etc." Great.
All the available voices in the engine can be obtained with,
Set<Voice> engineVoices = mTts.getVoices();
and this set can be inspected to determine what voices are actually installed on the device. Perfect, a set of voices supported by the engine and on the device has been obtained.
My question is: how to properly display the Voice name? There is no convenient getDisplayName() or similar on a Voice object. The name property of the Voice object is a string that can not be shown to the user "ko-kr-x-kod-local, pt-pt-x-jmn-network, fr-fr-x-frd-local, etc."
Do I need to hardcode a name:displayName map? This is bad practice as Google can change the name anytime. It could be handled as "Voice I, Voice II, Voice III, etc." but I find it hard to believe a consistent display name is not available somewhere. Have I missed it? Any thoughts?