From d88fb23c319aef1a019f7afcf2eb101c0637de89 Mon Sep 17 00:00:00 2001 From: Vladislav Antonyuk <33021114+VladislavAntonyuk@users.noreply.github.com> Date: Sat, 28 Oct 2023 01:19:31 +0300 Subject: [PATCH] Fixes Speech recognizer locale was not ignored on Android #1436 (#1481) --- .../SpeechToText/SpeechToTextImplementation.android.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.android.cs b/src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.android.cs index c5fac4652..0c92a2777 100644 --- a/src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.android.cs +++ b/src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.android.cs @@ -50,12 +50,12 @@ public async ValueTask DisposeAsync() static Intent CreateSpeechIntent(CultureInfo culture) { var intent = new Intent(RecognizerIntent.ActionRecognizeSpeech); - intent.PutExtra(RecognizerIntent.ExtraLanguagePreference, Java.Util.Locale.Default); + intent.PutExtra(RecognizerIntent.ExtraLanguagePreference, Java.Util.Locale.Default.ToString()); intent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm); intent.PutExtra(RecognizerIntent.ExtraCallingPackage, Application.Context.PackageName); intent.PutExtra(RecognizerIntent.ExtraPartialResults, true); - var javaLocale = Java.Util.Locale.ForLanguageTag(culture.Name); + var javaLocale = Java.Util.Locale.ForLanguageTag(culture.Name).ToString(); intent.PutExtra(RecognizerIntent.ExtraLanguage, javaLocale); return intent;