NumberFormat.simpleCurrency for es_CO with COP symbol on right and not left
Opened this issue · 4 comments
migueloli commented
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 commented
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.
migueloli commented
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 commented
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 commented
awesome, thank you very much