Ticket #86 (closed defect: fixed)

Opened 5 years ago

Last modified 3 years ago

Basic formatter numeric should converse Uservalue from internationalized format to standard format

Reported by: idbr Owned by: mpo
Priority: major Milestone: 0.4
Component: < I18N Version: trunk
Keywords: Cc:

Description

In the kauri-forms sample, when a localized numeric value (e.g. '3,14') is entered in the field 'Pi', a is-not-numeric validation error is produced. When a value with US locale is entered (e.g. '3.14'), it succeeds the numeric validation, and is formated following the current locale (in this case '3,14').

Attachments

basic-formatters.js.patch (732 bytes) - added by idbr 5 years ago.
Fix

Change History

comment:1 Changed 5 years ago by idbr

I was wondering if it should be considered valid if someone enters a correct numeric value in a locale that isn't his own, e.g. '3.14' with locale nl-BE.

I would say it is invalid, because of the ambiguity we get with '12,345.678' and '12.345,678', although this limits somehow the user friendliness.

Changed 5 years ago by idbr

Fix

comment:2 Changed 4 years ago by mpo

  • Milestone changed from 0.3 to 0.4

comment:3 Changed 3 years ago by mpo

The patch seems valid and a solid way to survive many possible mishaps.

The crux seems that the formatter isn't really operating in a way that can rountrip own values (ie parse own formatted strings) which in turn comes from the fact that the localeString() result doesn't match up with the new Number() argument.

Using the found numeric separators to deal with that assumes that those are derived from the current localString-trick on 9999.9 (see locale.js)

Before applying this, we should however properly deal with the mentioned i18n setting in the new issue #272 since that might alter the way 1000 and decimal separators are set in the first place.

comment:4 Changed 3 years ago by jgou

  • Priority changed from minor to major
  • Component changed from modules/kauri-forms to < I18N

comment:5 Changed 3 years ago by freya

  • Status changed from new to closed
  • Resolution set to fixed

patch applied in r1571

Note: See TracTickets for help on using tickets.