flutter_tts
flutter_tts copied to clipboard
getLanguages() data formatting
I'm curious if there is a way to get the language to provide more than the locale id.
When printing the data returned from getLanguages
, it returns a list of locale codes formatted like so:
[ru-RU, en-US, es-ES, ... ]
Is there a built-in way to get the name associated with the locale id? I want to display English - US
rather than en-US
.
@CodyBontecou Is this for Android? I easiest thing to do here without introducing a breaking change is to create a getDisplayCountry() method which calls it against the locale. I'll see if there is something similar on iOS.
For now, it's Android but I'd prefer a universal solution if possible.
Do the languages get returned as a Locale type on Android??
@CodyBontecou yes they do
for (Locale locale : tts.getAvailableLanguages()) {
locales.add(locale.toLanguageTag());
}