10000 Fixed #35095 Updated Swiss (German) number formatting to match common IT practices. by AhmedNassar7 · Pull Request #19396 · django/django · GitHub
[go: up one dir, main page]

Skip to content

Fixed #35095 Updated Swiss (German) number formatting to match common IT practices. #19396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AhmedNassar7
Copy link
Contributor
@AhmedNassar7 AhmedNassar7 commented Apr 20, 2025

Trac ticket number

ticket-35095

Branch description

Per Swiss IT conventions, use dot (.) as decimal separator and single quote (')
as thousand separator. This aligns with common practices in Swiss operating
systems and applications.

Document context-specific formatting limitations:

  • Monetary: Fr. 23.50
  • Measurements: 22,5 m

Since Django cannot handle context-specific formats, follow the more common
IT standard format that uses dot as decimal separator.

References:

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

Copy link
Contributor
@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @AhmedNassar7
I have minor comments 👍

DECIMAL_SEPARATOR = ","
THOUSAND_SEPARATOR = "\xa0" # non-breaking space
DECIMAL_SEPARATOR = "."
THOUSAND_SEPARATOR = "'" # single quote
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have agreement to update the THOUSAND_SEPARATOR
Also reading the linked wikepedia docs, it says (translated):

Neither dot nor comma are used as thousand separators. If a protected space is not set as a thousand separator, the (even) apostrophe (') is used.

Meaning the space is used (I'd assume more commonly), with the apostrophe being the exception

Comment on lines +194 to +206
The Swiss number formatting traditionally varies depending on context. For example,
monetary values might use a dot as decimal separator (Fr. 23.50), while
measurements might use a comma (22,5 m). Django's localization system cannot
handle such context-specific formats automatically.

The locale format provided by Django follows common IT practices in Switzerland,
using a dot as the decimal separator and a single quote as the thousand
separator, matching the behavior of major operating systems and applications
in the region.

For Swiss government publication guidelines and additional context, see:
- https://www.bk.admin.ch/bk/de/home/dokumentation/sprachen/hilfsmittel-textredaktion/schreibweisungen.html
- https://de.wikipedia.org/wiki/Dezimaltrennzeichen#Schweiz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Swiss number formatting traditionally varies depending on context. For example,
monetary values might use a dot as decimal separator (Fr. 23.50), while
measurements might use a comma (22,5 m). Django's localization system cannot
handle such context-specific formats automatically.
The locale format provided by Django follows common IT practices in Switzerland,
using a dot as the decimal separator and a single quote as the thousand
separator, matching the behavior of major operating systems and applications
in the region.
For Swiss government publication guidelines and additional context, see:
- https://www.bk.admin.ch/bk/de/home/dokumentation/sprachen/hilfsmittel-textredaktion/schreibweisungen.html
- https://de.wikipedia.org/wiki/Dezimaltrennzeichen#Schweiz
The Swiss number formatting traditionally varies depending on context. For
example, monetary values may use a dot as decimal separator (``Fr. 23.50``),
while measurements often use a comma (``22,5 m``). Django’s localization system
does not support such context-specific variations automatically.
Django follows the commonly accepted IT conventions for Swiss locales. These
use a dot as the decimal separator and a space as the thousands separator,
consistent with the behavior of major operating systems and software
applications used in Switzerland.

I think I wouldn't add the linked references (partly because these are in German and I can't imagine we need to add more information here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0