Bug 15911 - Easier way to get Currency Symbols for other locales?
Summary: Easier way to get Currency Symbols for other locales?
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.0.2.x
Hardware: Macintosh Mac OS
: --- enhancement
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-11-04 15:04 UTC by Jon Goldberger [MSFT]
Modified: 2017-07-26 08:42 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Comment 1 Jon Goldberger [MSFT] 2013-11-04 15:05:30 UTC
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:

// 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?
Comment 2 Jon Goldberger [MSFT] 2013-11-04 15:07:18 UTC
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
Comment 3 Sebastien Pouliot 2013-11-04 15:51:58 UTC
> extract a currency symbol from the supplied country code.

The simplest way would be to use .NET RegionInfo.CurrencySymbol [1]. This API is easier to use [2] and has the extra advantage of being cross-platform (available for Android, Mac, Windows…). e.g.

   Console.WriteLine (new RegionInfo("US").CurrencySymbol); // $

[1] http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo.currencysymbol.aspx

[2] 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.
Comment 4 Prashant [MSFT] 2017-07-26 08:42:17 UTC
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