I have no idea what `Locale.ROOT` refers to, and I'd be worried that it's accidentally the same as the system locale or something, exactly the sort of thing that will unexpectedly change when a Turkish-speaker uses a computer or what have you.
I have no idea what `Locale.ROOT` refers to, and I'd be worried that it's accidentally the same as the system locale or something, exactly the sort of thing that will unexpectedly change when a Turkish-speaker uses a computer or what have you.
The API docs clearly specify that Locale.ROOT “is regarded as the base locale of all locales, and is used as the language/country neutral locale for the locale sensitive operations.”
Isn't it kind of strange to say that Locale.US is too US centric, and therefore we'll invent a new, fictitious locale, the contents of which is all the US defaults, but which we'll call "the base locale of all locales"? That somehow seems even more US centric to me than just saying Locale.US.
Setting the locale as Locale.US is at least comprehensible at a glance.
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.ROOT);
System.out.println(dateFormat.format(new Date()));
dateFormat = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.ROOT);
System.out.println(dateFormat.format(new Date()));
NumberFormat numberFormatter = NumberFormat.getNumberInstance(Locale.ROOT);
System.out.println(numberFormatter.format(12.34));
NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(Locale.ROOT);
System.out.println(currencyFormatter.format(12.34));
2025 Oct 13
10:12:42
12.34
¤ 12.34
Even POSIX C is less American than I expected, with a metric paper size and no currency symbol defined (¤ isn't in ASCII). Only the American date format.