openpnp / openpnp

Open Source SMT Pick and Place Hardware and Software
http://openpnp.org
GNU General Public License v3.0
1.64k stars 553 forks source link

Decimal formatting and parsing does not respect Locale #54

Closed vonnieda closed 9 years ago

vonnieda commented 11 years ago

From Johannes Taelman:

"I had to configure my system settings (windows) to using point as seperator between number and number fraction. In belgium - and a lot of other non-english speaking countries - we use a comma. I couldn't enter valid numbers in openpnp otherwise... Practically I'm perfectly OK with using points in the english way to configure openpnp, I even expect technical software to do so."

There are two issues at hand:

Many places in the codebase that parse decimals are not using DecimalFormat, but instead are using Double.parseDouble, which does not respect Locale. The code needs to be swept to make sure all parsing and formatting of human data respects the current locale.

It is suggested by the conversation resulting from that email that the Locale be fixed to US so that decimal is always the period. This is probably best left as an option to the user, but fixing the first point will enable us to make it a choice.

vonnieda commented 9 years ago

We have merged #67 to fix the problem and in the future we may want to support multiple locales.