Xamarin -- getting user's Locale, or converting from CultureInfo.CurrentCulture to Xamarin.Essentials.Locale.

Mark Fairchild 1 Reputation point

I'm doing some work with TTS in Xamarin, and I'm pretty new to this platform. I'd like to select a Locale for the TTS system based on the user's language settings, but CultureInfo doesn't seem to provide any convenient way to map to a Locale. Any tips?

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,325 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,951 Reputation points


    Welcome to our Microsoft Q&A platform!

    To get the user's locale, try using CultureInfo.CurrentCulture property.

       var cultureName = CultureInfo.CurrentCulture.Name;  

    Here are the related docs, you could refer to:

    Best Regards,

    Jarvan Zhang

    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.

    0 comments No comments