java-faker icon indicating copy to clipboard operation
java-faker copied to clipboard

Price not respect set locale

Open schrek1 opened this issue 5 years ago • 4 comments

I set explicitly locale in the constructor Faker f = new Faker(Locale.ENGLISH); but if I call f.commerce().price() it returns number in computer locale format.

I think it is becouse in price is called new DecimalFormat("#0.00").format(price); and inside it is called Locale.getDefault instead should use preset locale in faker constructor e.g. DecimalFormat("#0.00", new DecimalFormatSymbols(userLocale))

schrek1 avatar Sep 11 '19 13:09 schrek1

Hi same problem here, great correction. Did you propose a Pull request for this issue ? @schrek1

clarenced avatar Apr 06 '20 12:04 clarenced

Same here, please correct this, the fix to this issue has posted by @schrek1

IliasPapanikolaou avatar Dec 14 '21 12:12 IliasPapanikolaou

Have the same issue as well, as work around i'm using

Locale.setDefault(Locale.US);

on initing my project

AlexZhuk avatar Oct 29 '22 14:10 AlexZhuk

This is probably fixed in Datafaker.net, could you give that a shot?

bodiam avatar Oct 30 '22 02:10 bodiam