How to know the Phone's country code?
How do I find the country code of the phone?
Or perhaps other information 开发者_StackOverflow社区about the country that the phone is at?
You can use the CultureInfo.CurrentCulture.Name
property:
String currentCultureName = System.Globalization.CultureInfo.CurrentCulture.Name;
will return the culture name that the phone is set to in the format "languagecode-country/regioncode", for example "en-US"
If you're looking for the country of the devices present location you can pull this from the location service and reverse geocoding. An sample implementation here by Nick Harris.
How to Reverse Geocode a Location to an Address on Windows Phone 7
That is what exactly the globalization part in .net is all about. It stores the culture information in a cultureinfo class. currentculture gives the current culture settings. The most important class in the System.Globalization namespace is the class CultureInfo. CultureInfo represents a culture and defines calendars, formatting of numbers and dates, and sorting strings that are used with the culture. The class RegionInfo represents regional settings(such as the currency) and shows if the region is using the metric system. In the same region, you can use multiple languages. One example is the region of Spain with its Basque(eu-ES), Catalan(ca-ES), Spanish(es-ES), Galician(gl-ES)cultures
eg: CultureInfo ci = new CultureInfo(“fr-FR”);
Refer More in the PPT
精彩评论