java-faker
java-faker copied to clipboard
Use the locale in String.formtat()
Describe the bug
The string format should benefit from the Faker locale (Locale.ENGLISH by default), otherwise a formatted string like the longitude or latitude, can be 1.234567 or 1,234567 depending in the Locale.
To Reproduce
Using a String.format("%.8g", (faker.random().nextDouble() * 180) - 90);
- depends on external JVM configuration
- if Locale PT then 1,234567.
Using a String.format(Locale.ENGLISH, "%.8g", (faker.random().nextDouble() * 180) - 90);
- controlled by the application
- then 1.234567.
Expected behavior
String.format(Locale.ENGLISH, "%.8g", (faker.random().nextDouble() * 180) - 90);
- controlled by the application
- then 1.234567.
Versions:
- OS: Any
- JDK: Any
- Faker Version: using 0.18 - however the implementation seems to be the same in the last version
Additional context
Yes we have the same problem. Locale ignored for String.format().