Ethan Allen
Ethan Allen

Reputation: 14835

What's the Windows Phone 7 C# equivalent of the iOS call [[NSLocale currentLocale] localeIdentifier]?

Here is the iOS code I have:

[[[NSLocale currentLocale] localeIdentifier] isEqualToString:@"en_US"]

Is there anything similar on the Windows Phone 7 C# side to find out what locality the user has chosen on their device?

Upvotes: 1

Views: 148

Answers (2)

Shawn Kendrot
Shawn Kendrot

Reputation: 12465

I'm guessing you would want to use

System.Globalization.CultureInfo.CurrentCulture

or

System.Globalization.CultureInfo.CurrentUICulture

You can test for "en_US" with the IetfLanguageTag property

System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag == "en_US"

Upvotes: 1

Ethan Allen
Ethan Allen

Reputation: 14835

Someone please confirm this, but here's what I think the answer may be:

if (CultureInfo.CurrentCulture.Name.ToString() == "en-US")

Upvotes: 0

Related Questions