I want to download a website's content based on user's current region. For that I need country code like US , FR etc.. How to get that?
I tried these:
this always shows US. I think it comes from app manifest.
var region = RegionInfo.CurrentRegion;
and this:
var cultureName = new DateTimeFormatter("longdate", new[] { "US" }).ResolvedLanguage;
return new CultureInfo(cultureName);
this works. returns something like en-US which I can extract country code from it. but sometimes it may return only language en without country code.
How to get system's current two character country code? thanks.