Может быть полезный код (C #)
private const int GEOCLASS_NATION = 16;
//SYSGEOTYPE
private const int GEO_NATION = 1;
private const int GEO_LATITUDE = 2;
private const int GEO_LONGITUDE = 3;
private const int GEO_ISO2 = 4;
private const int GEO_ISO3 = 5;
private const int GEO_RFC1766 = 6;
private const int GEO_LCID = 7;
private const int GEO_FRIENDLYNAME = 8;
private const int GEO_OFFICIALNAME = 9;
private const int GEO_TIMEZONES = 10;
private const int GEO_OFFICIALLANGUAGES = 11;
#region Win32 Declarations
// [DllImport("kernel32.dll", ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
// private static extern int GetUserGeoID(GeoClass geoClass);
[DllImport("kernel32.dll")]
static extern int GetUserGeoID(int geoId);
[DllImport("kernel32.dll")]
private static extern int GetUserDefaultLCID();
[DllImport("kernel32.dll")]
private static extern int GetGeoInfo(int geoid, int geoType, StringBuilder lpGeoData, int cchData, int langid);
#endregion
private string GetGeoFriendlyName(int geoId)
{
int lcid = GetUserDefaultLCID();
StringBuilder bldr = new StringBuilder(50);
GetGeoInfo(geoId, GEO_FRIENDLYNAME, bldr, bldr.Capacity, lcid);
return bldr.ToString();
}
private string GetGeoIso2(int geoId)
{
int lcid = GetUserDefaultLCID();
StringBuilder bldr = new StringBuilder(50);
GetGeoInfo(geoId, GEO_ISO2, bldr, bldr.Capacity, lcid);
return bldr.ToString();
}
// HKEY_CURRENT_USER\Control Panel\International\Geo"
using (var regKeyGeo = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Control Panel\International\Geo"))
{
var NationValue = Convert.ToInt32(regKeyGeo.GetValue("Nation").ToString());
int geoId = GetUserGeoID(GEOCLASS_NATION);
string friendlyName = GetGeoFriendlyName(geoId);
Response.Write("GetUserGeoID: " + geoId + " - friendlyName: " + friendlyName + @". HKEY_CURRENT_USER\Control Panel\International\Geo - Nation: " + NationValue + " - " + GetGeoFriendlyName(NationValue));
var iso2 = GetGeoIso2(geoId);
Response.Write(" - GetGeoIso2: " + iso2);
var regionGeo = new RegionInfo(iso2);
Response.Write(" - " + regionGeo.DisplayName + " - " + regionGeo.ISOCurrencySymbol);
var cultureInfo = CultureInfo.GetCultures(CultureTypes.AllCultures).Where(c => c.Name.EndsWith(iso2));
var culture = cultureInfo.ToList()[0];
Response.Write("<br /> Culture for " + iso2 + ": " + culture.DisplayName + " - " + culture.DateTimeFormat.FullDateTimePattern);
}