What I want is to format numbers, dates etc. with current system regional settings which can be cusomized.
I want to use cutomized format settings in OS and tell java to use this settings while formatting values.
For example I have selected French (Canada) region but cusomized decimal separator symbol to ‘#’ instead ‘,’.
Now I want to tell java to format number 1.2
as 1#2
I tried:
System.out.println(Locale.getDefault()); // fr_CA
System.out.printf(Locale.getDefault(), "%.1f%n", 1.2); // 1,2 (decimal separator: comma)
System.out.printf(Locale.CANADA_FRENCH, "%.1f%n", 1.2); // 1,2 (decimal separator: comma)
System.out.printf(Locale.ROOT, "%.1f%n", 1.2); // 1.2 (decimal separator: dot)
System.out.printf((Locale) null, "%.1f%n", 1.2); // 1.2 (decimal separator: dot)
Also, I noticed, that Locale is not that I want. Locale is just the name of language and country.
Locale.getDefault() // - jvm locale
Locale.ROOT // - neutral locale
(Locale) null // - no localization is applied (Hmm... Locale.ROOT vs (Locale) null ?)
But I want to format numbers according to ssystem cusomized settings.
How can I do this?