@@ -10,22 +10,22 @@ res_type: kb
1010
1111## Environment
1212
13- | Version | Control | Author |
14- | ------- | ------- | ------ |
15- | SpeechToTextButton for .NET MAUI | [ Dobrinka Yordanova] ( https://www.telerik.com/blogs/author/dobrinka-yordanova ) |
13+ | Control | Author |
14+ | ------- | ------ |
15+ | SpeechToTextButton for .NET MAUI | [ Dobrinka Yordanova] ( https://www.telerik.com/blogs/author/dobrinka-yordanova ) |
1616
1717## Description
1818
1919This article explains how to check the supported languages for the SpeechToTextButton in .NET MAUI and how to set them.
2020
2121## Solution
2222
23- Here is an example of how to check the supported languages for the SpeechToTextButton in .NET MAUI. For the demo we will use
23+ Here is an example of how to check the supported languages for the SpeechToTextButton in .NET MAUI. For the demo, we will use:
2424* An Editor for displaying the recognized text.
25- * Entry for setting the language.
26- * Label for displaying whether the language is supported or not.
25+ * An Entry for setting the language.
26+ * A Label for displaying whether the language is supported or not.
2727
28- ** 1.** Define the ` RadSpeechToTextButton ` control in XAML.
28+ ** 1.** Define the ` RadSpeechToTextButton ` control in XAML:
2929
3030``` XAML
3131<Grid RowDefinitions =" Auto, *, 4*" >
@@ -43,7 +43,7 @@ Here is an example of how to check the supported languages for the SpeechToTextB
4343</Grid >
4444```
4545
46- ** 2.** In the code-behind, handle the ` TextChanged ` event of the Entry to check if the entered language is supported.
46+ ** 2.** In the code-behind, handle the ` TextChanged ` event of the Entry to check if the entered language is supported:
4747
4848``` C#
4949private void EntryLanguage_TextChanged (object sender , Microsoft .Maui .Controls .TextChangedEventArgs e )
@@ -67,10 +67,11 @@ private static bool IsLanguageSupported(string languageTag)
6767 try
6868 {
6969#if ANDROID
70- // // There is no programmatic way to check if a language is supported on Android but most languages are.
71- // // https://cloud.google.com/speech-to-text/docs/speech-to-text-supported-languages
70+ // There is no programmatic way to check if a language is supported on Android, but most languages are.
71+ // For a complete list, see: https://cloud.google.com/speech-to-text/docs/speech-to-text-supported-languages
72+ return true ;
7273#elif IOS
73- var locale = Foundation .NSLocale .FromLocaleIdentifier (languageTag );
74+ var locale = Foundation .NSLocale .FromLocaleIdentifier (languageTag );
7475 var localSpeechRecognizer = new Speech .SFSpeechRecognizer (locale );
7576 localSpeechRecognizer .Dispose ();
7677#elif WINDOWS
@@ -87,7 +88,7 @@ private static bool IsLanguageSupported(string languageTag)
8788}
8889```
8990
90- ** 3.** Handle the SpeechToTextButton's ` SpeechRecognized ` event to display the recognized text in the Editor.
91+ ** 3.** Handle the SpeechToTextButton's ` SpeechRecognized ` event to display the recognized text in the Editor:
9192
9293``` C#
9394private void SpeechToTextButton_SpeechRecognized (object sender , SpeechRecognizerSpeechRecognizedEventArgs args )
0 commit comments