Opened 9 years ago
Closed 8 years ago
#25920 closed New feature (fixed)
Add number formatting support for locales that use non-uniform digit grouping (e.g. India)
Reported by: | Binoj David | Owned by: | Szymon Teżewski |
---|---|---|---|
Component: | Internationalization | Version: | 1.9 |
Severity: | Normal | Keywords: | en-IN |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When using 'en-IN' as locale (listed as valid in http://www.i18nguy.com/unicode/language-identifiers.html) 100000.00 should look like 1,00,000.00 after using intcomma. Instead 100,000.00 is displayed.
Works as expected in locale package as below (with en_IN installed, of course):
In [1]: import locale In [2]: locale.setlocale(locale.LC_ALL, 'en_IN') Out[2]: 'en_IN' In [3]: locale.format("%.2f", 100000.00, grouping=True) Out[3]: '1,00,000.00'
Change History (11)
comment:1 by , 9 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 9 years ago
Resolution: | invalid |
---|---|
Status: | closed → new |
There is a complication in adding en_IN. Number grouping in en_IN is not grouped on 'n' number of digits. First 3 (ones, tens and hundreds) are grouped as a single group and the remaining digits are grouped as 2 digits per group. This can be achieved with a NUMBER_GROUPING setting. So I don't think this can be fixed by adding a locale.
comment:3 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Bug → New feature |
Confirmed, Django doesn't support this sort of grouping yet.
comment:4 by , 9 years ago
Component: | contrib.humanize → Internationalization |
---|---|
Summary: | django.contrib.humanize filters are not well localized for en_IN → Add number formatting support for locales that use non-uniform digit grouping (e.g. India) |
comment:5 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 9 years ago
Has patch: | set |
---|
comment:7 by , 9 years ago
PR for this: https://github.com/django/django/pull/6693
It basically adds possibility to use more robust NUMBER_GROUPING using style similar to POSIX locale grouping option.
comment:8 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I looked at the pull request, and think it looks RTC for the following reasons:
- Has tests
- Test suite passes
- Old functionality from previous tests remains unchanged.
comment:9 by , 9 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
A bit of documentation is missing as noted on the PR.
comment:10 by , 9 years ago
Patch needs improvement: | unset |
---|
I think the solution here is to add formats for the
en_IN
locale (like ff2e0896a3f7b566c8a0802b2191d30c6070c8f6, for example). Please send a pull request if you can do that. I don't think there's much value in leaving an open ticket for each locale that we're missing. Thanks!