Hm. That's a little odd, but there are more quirks to avoiding localization than I thought.
I've uploaded a new version. It has a better chance of working. Here's the critical code:
- // DecimalFormat sets formatting conventions from the local system, unless we tell it not to
- // make sure we use "." for decimal separator, as in US, not a comma, as in many other countries
- static {
- Locale loc = Locale.US;
- NumberFormat nf = NumberFormat.getNumberInstance(loc);
- DecimalFormat fourPlaces = (DecimalFormat)nf;
- DecimalFormatSymbols dfSymbols = new DecimalFormatSymbols(loc);
- dfSymbols.setDecimalSeparator('.');
- fourPlaces.applyPattern("0.0000");
- fourPlaces.setDecimalFormatSymbols(dfSymbols);
- }
For the previous patch I had just:
- static {
- Locale loc = Locale.US;
- DecimalFormatSymbols dfSymbols = new DecimalFormatSymbols(loc);
- fourPlaces = new DecimalFormat("0.0000", dfSymbols);
- }
The odd thing is, setting loc = Locale.FRANCE would give me commas, so I thought that setting Locale was all that was necessary. The documentation on DecimalFormat seemed to suggest that. I sample code on the Java Tutorial (
http://download.oracle.com/javase/tutorial/i18n/format/decimalFormat.html) that suggested it wasn't quite that simple--though if it isn't, it's a puzzle why my setting the locale to FRANCE would result in comma-separated numbers.
Odd also that Java would not respond to your control panel change. Exactly the sort of thing you would expect localized code to do. I guess it's getting its cues from some other part of your system.
Anyhow, I have hopes that this new version will work so I can move this library out the door.
Another general design issue has come to mind, but I'll start a new thread for that.
thanks,
-- Paul