dart-lang/i18n

Erroneous NumberFormat locale - pt_PT

Closed this issue · 4 comments

rmpt commented

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);
}
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

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

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

rmpt commented

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