dart-lang / i18n

A general mono-repo for Dart i18n and l10n packages.
BSD 3-Clause "New" or "Revised" License
58 stars 34 forks source link

Currency symbol is returning the ISO currency symbol instead of the actual symbol. #826

Open rsegecin opened 2 months ago

rsegecin commented 2 months ago

Describe the bug Currency symbol is returning the ISO currency symbol instead of the actual symbol. Eg. NumberFormat.currency(locale: 'pt_BR') format currency symbol returns BRL instead of "R$", or NumberFormat.currency(locale: 'en_US') format current returns USD instead of "$".

To Reproduce install intl package (current '0.19.0')

    String? getCurrencySymbol(String currencyCode) {
      try {
        NumberFormat format = NumberFormat.currency(locale: currencyCode);
        String currencySymbol = format.currencySymbol;
        return currencySymbol;
      } catch (e) {
        // Handle error or invalid currency code
        return null;
      }
    }

    print(getCurrencySymbol("en_US"));

it prints the wrong output.

rsegecin commented 2 months ago

I've just noticed that "format.simpleCurrencySymbol(format.currencySymbol)" does returns the actual symbol but still the description of format.currencySymbol says it returns For example, "$", "US$", or "€". instead of saying that it returns the ISO currency name.