Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Use NSSpeechSynthesizer.AttributesForVoice to correctly populate the X.E Locale on Mac. #1623

Merged
merged 4 commits into from
Jan 17, 2021

Conversation

CartBlanche
Copy link
Contributor

@CartBlanche CartBlanche commented Jan 8, 2021

Description of Change

Use NSSynthesiser Attributes to correctly populate the X.E Locale properties on Mac.
Fix Locale Name on iOS as it was incorrectly populating it with Language
Tweaked TTS demo, to list Languages, so that voices are changed correctly on all platforms.

Bugs Fixed

API Changes

None

Added:

None

Changed:

[Mac] Pass each voice to the NSSpeechSynthesizer.AttributesForVoice(), so we can then popolate the Locale object correctly.
https://github.com/CartBlanche/Essentials/blob/dominique-FixTTSLocaleOnMac/Xamarin.Essentials/TextToSpeech/TextToSpeech.macos.cs#L15-L18

[iOS] Populate Name property correctly.
https://github.com/CartBlanche/Essentials/blob/dominique-FixTTSLocaleOnMac/Xamarin.Essentials/TextToSpeech/TextToSpeech.ios.tvos.watchos.cs#L15-L16

[Sample] Use language to populate Action sheet, so languages can be changes across platforms.
https://github.com/CartBlanche/Essentials/blob/dominique-FixTTSLocaleOnMac/Samples/Samples/ViewModel/TextToSpeechViewModel.cs#L91-L95

Behavioural Changes

Tweaked how the Locale on Mac is populated as per changes above.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Fixed samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Updated documentation (see walkthrough)

@ghost
Copy link

ghost commented Jan 8, 2021

CLA assistant check
All CLA requirements met.

@CartBlanche
Copy link
Contributor Author

@mattleibow, @jamesmontemagno Let me know if there is anything else I should do to this PR, to get this merged??

Copy link
Contributor

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just checking on those possible nulls. If they will never be, then fine. But if possible, maybe there should be some check.

@mattleibow mattleibow added this to the 1.6.1 milestone Jan 14, 2021
Copy link
Contributor Author

@CartBlanche CartBlanche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@mattleibow
Copy link
Contributor

I did some testing on Android and they had a bunch of en for all the variants. I think we need to at some point parse the languages and create a better locale object.

@mattleibow mattleibow merged commit 2ef3407 into xamarin:main Jan 17, 2021
@CartBlanche CartBlanche deleted the dominique-FixTTSLocaleOnMac branch January 19, 2021 11:52
@CartBlanche
Copy link
Contributor Author

CartBlanche commented Jan 19, 2021

@mattleibow When will this hit X.E preview nugets?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants