Is there a way to get current information dynamically from the apps culture settings? Basically if the user has set the culture to US I want to know the currency is dollars
Once you have the CultureInfo ci object, you can ask such as
ci.NumberFormat.CurrencySymbol
For current culture, you will simply do
CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol
http://help.outlook.com/en-us/140/system.globalization.regioninfo.currencynativename(VS.85).aspx
You'll want the RegionInfo.CurrencyNativeName, RegionInfo.CurrencyEnglishName or RegionInfo.ISOCurrencySymbol
this worked for me.
var c = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
.Select(t=> new RegionInfo(t.LCID))
.Where(t=>t.ThreeLetterISORegionName == "USA")
.FirstOrDefault();
You can get the symbol from CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol
, but I doubt this is enough; you may need to maintain a separate list per culture. Or just let the user tell you what they want to pay in (for example, they might be away from home, etc, so the culture of the PC in some hotel lounge isn't what is on their credit card)
You can basically use CultureInfo class
CultureInfo ci = new CultureInfo(UICulture);
var symbol = ci.NumberFormat.CurrencySymbol;
public static string GetCurrencySymbol(string currency)
{
if (currency == null) return "";
if (currency == "") return "";
int i = 0;
var regionInfo = new RegionInfo(System.Threading.Thread.CurrentThread.CurrentUICulture.LCID);
foreach (var cultureInfo in CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures))
{
if (!cultureInfo.Equals(CultureInfo.InvariantCulture))
{
var regionCulture = new RegionInfo(cultureInfo.LCID);
if(regionCulture.ISOCurrencySymbol == currency)
{
//list.Add(regionCulture);
regionInfo = regionCulture;
}
}
}