Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25928 closed Bug (fixed)

Documentation on THOUSAND_SEPARATOR and NUMBER_GROUPING is still misleading

Reported by: Felix Dreissig Owned by: Wingston SHaron
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: f30@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The THOUSAND_SEPARATOR and NUMBER_GROUPING settings are only used if the current locale doesn't specify a thousands separator. This has been reported in #15918 and the following sentence has been added to the documentation:

Note that if USE_L10N is set to True, then the locale-dictated format has higher precedence and will be applied instead.

However, the same page of the documentation says about USE_THOUSAND_SEPARATOR:

When USE_L10N is set to True and if this is also set to True, Django will use the values of THOUSAND_SEPARATOR and NUMBER_GROUPING to format numbers.

These two quotes are kind of contradictory, because obviously one really can't use USE_THOUSAND_SEPARATOR without USE_L10N. The latter quote is plain wrong in most cases, as most locales define thousands separators.

THOUSAND_SEPARATOR and NUMBER_GROUPING are really only respected if USE_L10N = True, USE_THOUSAND_SEPARATOR = True and the locale doesn't specify a thousands separator. I think it would be great to just use USE_THOUSAND_SEPARATOR without USE_L10N and manually set THOUSAND_SEPARATOR and NUMBER_GROUPING, but that is currently not possible.

Anyway, I think the discrepancy should at least be removed form the documentation.

Regards,
Felix

Change History (6)

comment:1 by Felix Dreissig, 9 years ago

Cc: f30@… added

comment:2 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted

Could you submit a pull request with the proposed clarifications?

comment:3 by Wingston SHaron, 9 years ago

Owner: changed from nobody to Wingston SHaron
Status: newassigned

can you take a look and see if the clarifications are correct?

https://github.com/Wingie/django/tree/ticket_25928

in reply to:  3 comment:4 by Felix Dreissig, 9 years ago

Replying to Wingie:

can you take a look and see if the clarifications are correct?

https://github.com/Wingie/django/tree/ticket_25928

Looks good to me, it precisely describes the current behavior.
You could get rid of the ":setting:USE_L10N is set to True, and" part in the second paragraph though, as the previous paragraph already states that USE_L10N must always be True. I find that repetition rather confusing.

One could also ask if a behavior which requires such verbose explanations is really sensible, but that's out of scope for this bug report.

Thanks for the fix,
Felix

comment:5 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In abcf3fe6:

[1.9.x] Fixed #25928 -- Clarified precendence of USE_THOUSAND_SEPARATOR and locale formats.

Backport of 7f218d98915ef3e76a98ef72075a6bde907dfe41 from master

comment:6 by Tim Graham <timograham@…>, 9 years ago

In 7f218d98:

Fixed #25928 -- Clarified precendence of USE_THOUSAND_SEPARATOR and locale formats.

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