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)
Change History (12)
by , 13 years ago
Attachment: | set_nbsp_instead_of_space_as_a_thousand_separator.diff added |
---|
comment:1 by , 13 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
comment:2 by , 13 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:4 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → new |
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 , 12 years ago
Cc: | added |
---|
comment:6 by , 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 , 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 , 12 years ago
I've created a pull request, please review: https://github.com/django/django/pull/726
comment:10 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.
If we wanted to follow this logic entirely, we should also patch
docs/topics/i18n/formatting.txt
.