Is it possible to localize numbers in String.format in the same way as NumberFormat.format?
I expected to just use
String.format(locale, "%d", number)
but this does not return the same result as when using NumberFormat. For instance:
String.format(Locale.GERMAN, "%d", 1234567890)
gives: "1234567890", and
NumberFormat.getNumberInstance(Locale.GERMAN).format(1234567890)
gives: "1.234.567.890"
If this is not possible, then what is the recommended way to localize text, including numbers?
source share