You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Essentials] Make Locale constructible by external TextToSpeech backends
Microsoft.Maui.Media.Locale only had an internal constructor, so an
out-of-tree ITextToSpeech implementation could not implement
GetLocalesAsync or populate SpeechOptions.Locale without reflection or
forking. Community backends (for example Maui.Tizen) had to mark locale
enumeration as unsupported.
Make the existing constructor public and normalize null arguments to
string.Empty so the non-nullable Language/Country/Name/Id contract that
PublicAPI already declares is actually honored. Values are otherwise
stored verbatim: not parsed, validated, trimmed, or case normalized.
Immutability, reference equality, and the default ToString are unchanged.
Because locales can now be created with empty Id/Language, tighten the
platform voice-selection guards from `!= null` to string.IsNullOrEmpty so
a language-only locale still falls back the way it does today. This also
fixes a latent NullReferenceException on Tizen where `options?.Locale.Language`
dereferenced a null Locale.
Add Essentials.ExternalBackend.UnitTests, a test assembly that has no
InternalsVisibleTo access to Microsoft.Maui.Essentials, proving an
external backend can implement ITextToSpeech, return Locale values from
GetLocalesAsync, and round-trip them through SpeechOptions.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
0 commit comments