Closed svzi closed 7 years ago
I've added another commit and I was forced to introduce a breaking API change.
SpeakOptions.language
got renamed to SpeakOptions.locale
, because of that is exactly what it was used for. The property did not contain the ISO 639-1 language code (like en
), but the BCP-47 code (like en-US
).
I needed the ability to instantiate a TTS instance with the language only. For that reason I did the renaming. I've also updated the README.md
and provided some samples. All changes are made to not break any existing integrations of the plugin. So the plugin will work withSpeakOptions.language = 'en-US';
as well (like it did before my changes).
I've also added an Android-only method, for querying all available languages of the device: getAvailableLanguages(): Promise<Array<Language>>
. That method can really help to prevent using wrong / not-existing language codes or locale codes.
That method could probably be implemented for iOS as well: https://developer.apple.com/documentation/avfoundation/avspeechsynthesisvoice/1619697-speechvoices?language=objc
I've modified
speak()
to return aPromise
instead ofvoid
. This allows better error handling. I've updated theREADME.md
accordingly and I added myself as contributor, upon your request on Slack. :)I'm not sure why here are so many changes listed. The husky task did run prior my push:
I hope everything else is ok. Let me know if I did miss something.