Opened 5 years ago

Closed 4 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


Space was replaced with nbsp only for Polish locale:
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 5 years ago.
17217-2.diff (3.9 KB) - added by Claude Paroz 5 years ago.
Also update docs/topics/i18n/formatting.txt

Download all attachments as: .zip

Change History (12)

comment:1 Changed 5 years ago by Aymeric Augustin

Easy pickings: set
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
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 5 years ago by Aymeric Augustin (previous) (diff)

Changed 5 years ago by Claude Paroz

Attachment: 17217-2.diff added

Also update docs/topics/i18n/formatting.txt

comment:2 Changed 5 years ago by Jannis Leidel

Triage Stage: AcceptedReady for checkin

comment:3 Changed 5 years ago by Jannis Leidel

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 Changed 4 years ago by Alexey Boriskin

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 Changed 4 years ago by Alexey Boriskin

Cc: sun.void@… added

comment:6 Changed 4 years ago by Claude Paroz

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 Changed 4 years ago by Alexey Boriskin

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 Changed 4 years ago by Alexey Boriskin

I've created a pull request, please review:

comment:9 Changed 4 years ago by Claude Paroz <claude@…>

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 Changed 4 years ago by Claude Paroz

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