Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumberFormat.simpleCurrency for es_CO with COP symbol on right and not left #854

Open
migueloli opened this issue Jul 3, 2024 · 4 comments

Comments

@migueloli
Copy link

When we set the locale for es_CO with name as COP he changes the position of the $ from left to right.

code examples executed on DartPad:

// This shows the $ at left

import 'package:intl/intl.dart';

void main() {
  final format = NumberFormat.simpleCurrency(name: 'COP');
  print(format.format(100));
}
// This shows the $ at right

import 'package:intl/intl.dart';

void main() {
  Intl.defaultLocale = 'es_CO';
  final format = NumberFormat.simpleCurrency(name: 'COP');
  print(format.format(100));
}
// This shows the $ at right

import 'package:intl/intl.dart';

void main() {
  final format = NumberFormat.simpleCurrency(locale: 'es_CO', name: 'COP');
  print(format.format(100));
}
// This shows the $ at left

import 'package:intl/intl.dart';

void main() {
  final format = NumberFormat.simpleCurrency(locale: 'en', name: 'COP');
  print(format.format(100));
}
@mosuem
Copy link
Member

mosuem commented Jul 8, 2024

This is because the es_CO locale probably falls back to es_419, which specifies the currency to be on the right. So it is working as intended.

@mosuem mosuem closed this as completed Jul 8, 2024
@migueloli
Copy link
Author

migueloli commented Jul 8, 2024

Hey @mosuem, thanks for the reply

On dartpad these two options show the $ to the left of the value ($100.00) as is expected for Colombia:

import 'package:intl/intl.dart';

void main() {
  Intl.defaultLocale = 'es_419';
  final format = NumberFormat.simpleCurrency(locale: 'en_419' ,name: 'COP');
  print(format.format(100));
}
import 'package:intl/intl.dart';

void main() {
  final format = NumberFormat.simpleCurrency(locale: 'es_419' ,name: 'COP');
  print(format.format(100));
}

@mosuem
Copy link
Member

mosuem commented Jul 8, 2024

Ah, indeed es_CO is not known and falls back to es, not es_419. This should be fixed, or will be in the (hopefully out of experimental soon) package:intl4x.

@migueloli
Copy link
Author

awesome, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants