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, or if they have it set to UK I want to pound sterling etc... etc..
This is so I can send this information to PayPal when a payment is being made
Use the RegionInfo.ISOCurrencySymbol property. For example:
var ri = new RegionInfo(System.Threading.Thread.CurrentThread.CurrentUICulture.LCID);
Console.WriteLine(ri.ISOCurrencySymbol);
Output: "USD"
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)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With