Ticket #699 (closed defect: wontfix)

Opened 15 months ago

Last modified 14 months ago

Support for localized float representation

Reported by: philipp Owned by: tof
Priority: normal Milestone: 3.1.1
Component: Prado Framework v3 Version: 3.1
Severity: feature Keywords:
Cc:

Description

I am currently working on a completely localized project and came across two minor things with localized floats: TDataTypeValidator does not account for them, if I specify type "Float" it always wants a dot ('.') as decimal separator. In German this is a comma (',') for example. The same is true for TPropertyValue::ensureFloat().

I attached two little patches that solve these two problems by looking at the current locale information for the decimal separator.

It would be great for these two patches to be incorporated into PRADO. They should not break any existing behavior, as the TDataTypeValidator has a new type "LocalizedFloat?" (thus the result with using the current type "Float" is the same). TPropertyValue::ensureFloat() still returns a float data type at all times, so the change shouldn't be too bad in terms of BC.

Attachments

prado_localized_float.patch (4.0 kB) - added by philipp 15 months ago.
prado_localized_float_part2.patch (0.7 kB) - added by philipp 15 months ago.

Change History

Changed 15 months ago by philipp

Changed 15 months ago by philipp

Changed 15 months ago by xue

  • owner changed from xue to tof

Changed 14 months ago by tof06

  • status changed from new to closed
  • resolution set to wontfix

I think Prado's internationalization should not go so far... If we do, we also need to support thousand separator, currency char, ... As a french user (in France, decimal separator char is also a coma), I always use the dot, because it's much simpler to type (the numeric keypad as a dot key, not a coma). If you really need for your project a localized float validator, just extends TDataTypeValidator to add this support.

Changed 14 months ago by enrico

  • status changed from closed to reopened
  • resolution wontfix deleted

I can't agree with tof06. It's complete ignorant to say just because I'm not using it it would be overcharge prados internationalization/localization.

I agree with philipp localized floats should be implemented.

Regards Enrico

Changed 14 months ago by xue

  • status changed from reopened to closed
  • resolution set to wontfix

We decided not to implement it not just because we don't use it. Tof and I had a long dicussion and debate on whether we should support it or not.

As Tof pointed out in the ticket reply, localization involves many more aspects, rather than just the decimal separator. If we support decimal separator, what about thousand separator? and what about other localized notations? We think we better leave these kinds of parsing to developers, as they know better how to handle them.

Changed 14 months ago by philipp

Unfortunately, I didn't realize there was a debate going on, so I could not participate. Anyways, the argument with also having to support thousand separators and so on is not completely correct, as this is not supported in the default validator for the English notation either. I don't know much about other methods of writing floats (e.g. in Arabic), so I cannot speak for that area. Is there someone out more knowledge in that field? So I still see this patch as a good idea to add to the prado core.

PS: on German keyboards, the numpad doesn't have a dot, only a comma.

Note: See TracTickets for help on using tickets.