View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002135||FreeCAD||Bug||public||2015-05-31 16:19||2018-09-12 09:22|
|Platform||64-bit||OS||Linux/Kubuntu||OS Version||14.04.2 LTS|
|Target Version||Fixed in Version|
|Summary||0002135: Units module is not properly considering the QLocale::groupSeparator() character|
|Description||Some stupid languages, like Spanish, are not using the common dot decimal separator, but they have comma. That is well supported in FreeCAD, however some NaN stupid level languages, like Spanish, has a group separator (so called thousands separator), which seems is not well supported by FreeCAD.|
|Steps To Reproduce||>>> q = Units.Quantity('1,2 m')|
>>> q = Units.Quantity('1.200 mm')
>>> q = Units.Quantity('1.200,0 mm')
Traceback (most recent call last):
File "<input>", line 1, in <module>
ValueError: syntax error
|Additional Information||It is a problem because QLocale::toString cannot be used.|
|Tags||documentation, locale, units|
I strongly disagree. The units parser must NOT get any locale specific strings as input.
The input must always be plain C strings because otherwise you cannot force the same behaviour on all platforms.
As an example consider a Python script. If the units parser supported locales and you build a string from a number in Python (which results into a C string) then the script behaves differently on different systems.
The next big problem is that you always have to extend the units parser to support all kind of special characters for decimal point and separator. There are languages that have other characters than dot or comma for this.
Locale specific strings must only be taken into account for our special Qt widgets that support units which are InputField and QuantitySpinBox.
"Locale specific strings must only be taken into account for our special Qt widgets that support units which are InputField and QuantitySpinBox."
I don't know if I'm wrong, but for the Python developers it is resulting in several inconsistencies that they should manually fix adding a lot of useless code.
Maybe I'm wrong, but there are not documentation about Gui::InputField or Gui::QuantitySpinBox either.
|2015-05-31 16:19||Sanguinario_Joe||New Issue|
|2015-06-02 15:17||wmayer||Note Added: 0006181|
|2015-06-03 11:05||Sanguinario_Joe||Note Added: 0006185|
|2017-01-11 22:34||Kunda1||Note Added: 0007659|
|2017-01-11 22:34||Kunda1||Tag Attached: documentation|
|2017-01-16 18:52||Kunda1||Tag Attached: locale|
|2017-05-02 11:09||Kunda1||Relationship added||related to 0002195|
|2017-05-24 17:32||Kunda1||Tag Attached: units|
|2018-09-12 09:22||wmayer||Status||new => closed|
|2018-09-12 09:22||wmayer||Resolution||open => won't fix|