Opened 16 years ago

Closed 13 years ago

#6392 closed New feature (fixed)

django.contrib.humanize should be locale aware

Reported by: Marc Fargas Owned by: Jannis Leidel
Component: Internationalization Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently "humanize" assumes that the decimal separator is "." and "," for (dunno name) what you put every three digits.
In some languages (europe) it's just the reverse. Maybe 'humanize' could be aware of the current language. Otherwise humanize is nonsense on Europe and almost anywhere outside US ;)

Attachments (3)

humanize-numbers-locale.patch (5.3 KB ) - added by hlian 15 years ago.
An initial patch
6392.diff (6.5 KB ) - added by Jannis Leidel 14 years ago.
Updated patch which uses locale-aware formatting.
6392.2.diff (6.5 KB ) - added by dmclain 13 years ago.
Slight tweak to get patch to apply cleanly

Download all attachments as: .zip

Change History (14)

comment:1 by Chris Beaven, 16 years ago

Triage Stage: UnreviewedDesign decision needed

It would probably be easy enough to have the decimal and thousands separators translated.

by hlian, 15 years ago

An initial patch

comment:2 by hlian, 15 years ago

Has patch: set
Owner: changed from nobody to hlian
Status: newassigned

Here's an initial patch. I only have access to a Linux machine via a virtual machine, so I'd appreciate it if somebody with a non-en_US locale that implements different thousands/decimal separators could run the test and verify that it works.

I think this ticket conflicts with #9037.

comment:3 by Marc Garcia, 15 years ago

Keywords: i18n-rf added

comment:4 by Jannis Leidel, 14 years ago

Component: Contrib appsInternationalization
Owner: changed from hlian to Jannis Leidel
Patch needs improvement: set
Status: assignednew
Triage Stage: Design decision neededAccepted

Ok, the patch needs an update after we added locale-aware formatting.

by Jannis Leidel, 14 years ago

Attachment: 6392.diff added

Updated patch which uses locale-aware formatting.

comment:5 by Jannis Leidel, 14 years ago

Patch needs improvement: unset

comment:6 by Jannis Leidel, 14 years ago

I'm still not entirely sure if this is the right approach, any ideas would be much appreciated.

comment:7 by Jannis Leidel, 13 years ago

Keywords: i18n-rf removed

comment:8 by Julien Phalip, 13 years ago

Severity: Normal
Type: New feature

comment:9 by patchhammer, 13 years ago

Easy pickings: unset
Patch needs improvement: set

6392.diff fails to apply cleanly on to trunk

by dmclain, 13 years ago

Attachment: 6392.2.diff added

Slight tweak to get patch to apply cleanly

comment:10 by dmclain, 13 years ago

Patch needs improvement: unset

Looking over the patch, I'm not sure what, if anything is wrong with the approach. It seems like doing correct humanization across languages is a big win.

comment:11 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: newclosed

In [16168]:

Fixed #6392 -- Made django.contrib.humanize template tags locale aware. Thanks, Dave McLain.

Note: See TracTickets for help on using tickets.
Back to Top