Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #720 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

[PATCH] I18Nized Number validator

Reported by: godoy Owned by: anonymous
Priority: normal Milestone: 0.9a5
Component: TurboGears Version:
Severity: major Keywords:


The "Number" validator is not I18Nized, so if in one country you use "," for decimal separator and "." for group separator it will fail. (Even if you omit the group separator.)

I believe that some hack to fix it might be benefical and I'll try coming out with something like I did for the Money validator...


number_validator_i18n.diff Download (1.3 KB) - added by godoy 13 years ago.
I18Nization of turbogears.validators.Number validator.

Change History

comment:1 Changed 13 years ago by godoy

  • Summary changed from Number validator is not I18Nized to [PATCH] I18Nized Number validator

Here's the patch... If somebody can take a look and do more tests with it, I'd appreciate (I've also tested with strings, as in the formencode.validators.Number example and it works as expected).

I tried figuring out the number of decimal places and use format_decimal with this number. If there is no decimal place, then I use format_number to return the number with the correct grouping.

Changed 13 years ago by godoy

I18Nization of turbogears.validators.Number validator.

comment:2 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.9a5

committed at [1201]. Thanks!

Note: See TracTickets for help on using tickets.