I used UWP api to get Portugal in my WPF project, and below is my steps:
Step1: Right click References>Add Reference... > Browse> C:Program Files (x86)/Windows Kits/10/UnionMetadata/.winmd. Add it to your project as a reference. Note: You will need to change the filter to “All Files”
.
Step 2: Refer to Step 1 to add System.Runtime.WindowsRuntime.dll
to your project. Path: “C:/Program Files (x86)/Reference Assemblies/MicrosoftFramework/.NETCore/v4.5”
Step 3: Then use below code to get the Install voices:
private void Button_Click(object sender, RoutedEventArgs e)
{
using (SpeechSynthesizer synthesizer = new SpeechSynthesizer())
{
List<VoiceInformation> voiceInfolt =
(
from voice in SpeechSynthesizer.AllVoices
select voice
).ToList();
foreach (VoiceInformation info in voiceInfolt)
{
if (info.Language == "pt-PT")
{
txt.Text = info.Language;
}
}
}
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.