Opened 13 years ago

Closed 12 years ago

#17217 closed Bug (fixed)

Set nbsp instead of space as thousand separator

Reported by: fadeyev Owned by: nobody
Component: Translations Version:
Severity: Normal Keywords:
Cc: sun.void@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Space was replaced with nbsp only for Polish locale: https://code.djangoproject.com/ticket/13577
I wonder why it hasn't been done for all other locales that use a space as a thousand separator.

Attachments (2)

set_nbsp_instead_of_space_as_a_thousand_separator.diff (3.1 KB ) - added by fadeyev 13 years ago.
17217-2.diff (3.9 KB ) - added by Claude Paroz 13 years ago.
Also update docs/topics/i18n/formatting.txt

Download all attachments as: .zip

Change History (12)

comment:1 by Aymeric Augustin, 13 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

I'd be nice to check the typographical conventions of the 8 countries involved in this patch, just to be sure that NBSP is the proper character — there are other variants of SP.

That said, I can't imagine a reason why a SP would be better than a NBSP as thousand separator. The only difference is that the latter prevents line wrapping, and line wrapping in the middle of a number can't be correct. So, even if NBSP isn't the sanctioned character, I'd still be better than SP.

If we wanted to follow this logic entirely, we should also patch docs/topics/i18n/formatting.txt.

Last edited 13 years ago by Aymeric Augustin (previous) (diff)

by Claude Paroz, 13 years ago

Attachment: 17217-2.diff added

Also update docs/topics/i18n/formatting.txt

comment:2 by Jannis Leidel, 13 years ago

Triage Stage: AcceptedReady for checkin

comment:3 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: newclosed

In [17478]:

Fixed #17217 -- Use non breaking spaces for format localization in which spaces are used. Thanks, Claude Paroz.

comment:4 by Alexey Boriskin, 12 years ago

Resolution: fixed
Status: closednew

One thing that had not been considered when that patch was applied is that thousand separator is used not only for formatting, but in forms input too. It is rather hard to force users to use non-breaking space when they input numbers.
Probably we should have one setting for formatting and another for forms validation.

comment:5 by Alexey Boriskin, 12 years ago

Cc: sun.void@… added

comment:6 by Claude Paroz, 12 years ago

Yeah, this striked me too, some days ago. Wouldn't non-breaking space common enough to justify some special-casing when validating inputs?

comment:7 by Alexey Boriskin, 12 years ago

I think about using unicodedata module. Non-breaking space normalizes to normal space:

>>> import unicodedata
>>> unicodedata.normalize('NFKD', u'\xa0')
u' '

This way we can determine that non-breaking and usual spaces are roughly the same. So we can special-case non-breaking space without actually hardcoding it -)

comment:8 by Alexey Boriskin, 12 years ago

I've created a pull request, please review: https://github.com/django/django/pull/726

comment:9 by Claude Paroz <claude@…>, 12 years ago

In b19d83fc12ebbabbaa9d72286f2e4bfa071ff784:

Improved input sanitizing with thousand separators

For languages with non-breaking space as thousand separator,
standard space input should also be allowed, as few people know
how to enter non-breaking space on keyboards. Refs #17217.
Thanks Alexey Boriskin for the report and initial patch.

comment:10 by Claude Paroz, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top