dart-lang / i18n

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

Erroneous NumberFormat locale - pt_PT #821

Closed rmpt closed 6 months ago

rmpt commented 6 months ago

Describe the bug pt currency should be formatted as EUR and not BRL.

Based on the example at https://api.flutter.dev/flutter/intl/NumberFormat/locale.html, create a NumberFormat with:

  1. var formatter = NumberFormat.currency(locale: 'pt'); // or pt_PT and eu
  2. formatter.format(3);
  3. Result is BRL 3 but should be EUR 3

To Reproduce Add a minimal working example or, if not possible or available, any code which might help to reproduce the problem

void main(List<String> arguments) {
var formatter = NumberFormat.currency(
    locale: 'pt_PT',
    decimalDigits: 2
);
formatter.format(3);
}
mosuem commented 6 months ago
import 'package:intl/intl.dart';

void main() {
  var formatter = NumberFormat.currency(
      locale: 'pt_PT',
      decimalDigits: 2
  );
  print(formatter.format(3));
}

does print 3,00 EUR. The locale pt means pt_BR, so it will not print EUR.

rmpt commented 6 months ago

it does not print 3,00 EUR, it prints BRL, I've mentioned it var formatter = NumberFormat.currency(locale: 'pt'); // or pt_PT and eu

The result is always BRL

mosuem commented 6 months ago

Interesting. What does running https://dartpad.dev/?id=33450ca181a781f5e1909144c7aa834f print for you?

rmpt commented 6 months ago

In fact, from your example I see EUR. I've tried again and now it works. I'm not sure what was wrong, thanks anyway