Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
We have a need to extract a currency symbol from the supplied country code.
One of our developers has created a test objectivec app which does the following (comments show the output)
NSLocale *locale =[NSLocale currentLocale];
NSString *currency = [locale displayNameForKey:NSLocaleCurrencySymbol value:@"USD"];
NSLog(@"currency %@", currency); //$
currency = [locale displayNameForKey:NSLocaleCurrencySymbol value:@"GBP"];
NSLog(@"currency %@", currency); //£
He would like to be able to replicate this using the Xamarin Libraries - Its seems the DisplayNameForKey method is not exposed, Looking in the Assembly Browser at NSLocale he can seen the following methods:
public string GetCountryCodeDisplayName (string value)
return this.DisplayNameForKey (NSLocale._CountryCode, value);
public string GetCurrencyCodeDisplayName (string value)
return this.DisplayNameForKey (NSLocale._CurrencyCode, value);
public string GetIdentifierDisplayName (string value)
return this.DisplayNameForKey (NSLocale._Identifier, value);
public string GetLanguageCodeDisplayName (string value)
return this.DisplayNameForKey (NSLocale._LanguageCode, value);
We either need a GetCurrencySymbolDisplayName method, or DisplayNameForKey with the NSLocale constants exposing.
Let me know if this is unclear?
Can do this now with:
NSLocale locale = NSLocale.FromLocaleIdentifier ("en_GB"); // for Great Britain
string currencySymbol = locale.CurrencySymbol; // gives £
The locale identifiers can be found at: https://gist.github.com/jacobbubu/1836273
> extract a currency symbol from the supplied country code.
The simplest way would be to use .NET RegionInfo.CurrencySymbol . This API is easier to use  and has the extra advantage of being cross-platform (available for Android, Mac, Windows…). e.g.
Console.WriteLine (new RegionInfo("US").CurrencySymbol); // $
 This Apple API is a bit different and allow some kind of conversion between locales (e.g. you can ask the GBP symbol used in the US). It can be useful in some cases but I don't know of any locale that defines the currency symbol differently for another locale.
Thanks so much for taking the time to submit this report! I am marking this bug resolved, please use the solution from comment #3.
Please reopen the bug if you have use case where it's blocking from using .NET APIs