Switzerland (German) [...] For monetary values, **a comma is used as the
thousand separator** and a decimal point for the decimal separator.
At this link
(https://github.com/django/django/blob/main/django/conf/locale/de_CH/formats.py)
the comment says:
For monetary numbers, the DECIMAL_SEPARATOR is a . (decimal point) and
**the THOUSAND_SEPARATOR is a ' (single quote)**.
Unfortunately I'm not familiar with the `de_CH` locale, therefore I can't
say which one is correct.
--
Ticket URL: <https://code.djangoproject.com/ticket/35095>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Claude Paroz (added)
* resolution: => invalid
* status: new => closed
* component: Documentation => Internationalization
Comment:
As far as I'm aware, both the documentation and comments match.
> # These are the separators for **non-monetary numbers**. For monetary
numbers,
> # the DECIMAL_SEPARATOR is a . (decimal point) and the
THOUSAND_SEPARATOR is a
> # ' (single quote).
> DECIMAL_SEPARATOR = ","
> THOUSAND_SEPARATOR = "\xa0" # non-breaking space
So for non-monetary numbers, a comma is used for decimal and a space for
thousand separators, exactly the same format is
[https://docs.djangoproject.com/en/5.0/topics/i18n/formatting
/#switzerland-german documented].
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:1>
* status: closed => new
* resolution: invalid =>
Comment:
I agree with you that for non-monetary numbers, the documentation and the
code match.
What I pointed out is that, **for monetary numbers**, the documentation
says "a comma is used as the thousand separator", whilst the comment in
format says "the THOUSAND_SEPARATOR is a ' (single quote)".
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:2>
* type: Uncategorized => Cleanup/optimization
* easy: 0 => 1
* stage: Unreviewed => Accepted
Comment:
> What I pointed out is that, **for monetary numbers**, the documentation
says "a comma is used as the thousand separator", whilst the comment in
format says "the THOUSAND_SEPARATOR is a ' (single quote)".
OK, but it's not something that Django uses, so it's just a real minor
typo in docs/comments.
For the future, that kind of cleanups doesn't require a ticket, feel-free
to check sources and submit PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:3>
* cc: Silvan Spross (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:4>
Comment (by HimaTeju):
Replying to [comment:3 Mariusz Felisiak]:
> > What I pointed out is that, **for monetary numbers**, the
documentation says "a comma is used as the thousand separator", whilst the
comment in format says "the THOUSAND_SEPARATOR is a ' (single quote)".
>
> OK, but it's not something that Django uses, so it's just a real minor
typo in docs/comments.
>
> For the future, that kind of cleanups doesn't require a ticket, feel-
free to check sources and submit PR.
Hii! I am very new to open source, and I want to fix this typo, please
help me out. So where exactly is the typo? In the documentation or the
comments?
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:5>
* owner: nobody => NeilPen2005
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:6>
* has_patch: 0 => 1
Comment:
pull request: https://github.com/NeilPen2005/django/pull/1
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:7>
* has_patch: 1 => 0
Comment:
Patch should be sent via GitHub PR targeted to the `main` Django branch.
Do you have any Swiss friend who can confirm this change?
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:8>
Comment (by Alexander Lazarević):
In the comment is a reference to a seems to be official document:
https://www.bk.admin.ch/bk/de/home/dokumentation/sprachen/hilfsmittel-
textredaktion/schreibweisungen.html
{{{
Ziffern werden in Dreiergruppen zusammengefasst. 123 456 789
Besteht eine Zahl aus vier Ziffern, so wird die erste nicht abgesetzt,
sondern eine Vierergruppe gebildet. 1234
Zahlen, die aus mehr als vier Ziffern bestehen, werden von der Endziffer
aus in Dreiergruppen zerlegt. 22 333 / 222 333 / 1 222 333
}}}
{{{
Digits are grouped into groups of three. 123 456 789
If a number consists of four digits, the first is not separated, but a
group of four is formed. 1234
Numbers that consist of more than four digits are broken down into groups
of three starting from the final digit. 22 333 / 222 333 / 1 222 333
}}}
And
{{{
Die früher gebräuchliche Schreibung mit Apostroph sollte nicht mehr
angewendet werden, weil sie für die Drucklegung wieder rückgängig gemacht
werden muss. Nicht korrekt ist die Gliederung mit Punkten oder Kommas.
}}}
{{{
The previously used spelling with an apostrophe (aka single-quote) should
no longer be used because it has to be reversed for printing. The
structure with periods or commas is not correct.
}}}
So the THOUSAND_SEPARATOR seems to be the non-breaking-space (as
implemented) and not `single-quote` or `coma` (as in the PR), regardless
of plain numbers or monetary value.
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:9>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:10>
Comment (by Andrea Angelini):
I stumbled upon that discrepancy just by chance. I have no Swiss friend
that can confirm it. Checking the sources with Google seems to favor the
single quote.
What I also found is that Angular `CurrencyPipe` seems to use the single
quote as thousand separator.
https://github.com/angular/angular/issues/46038#issuecomment-1335706796
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:11>
Comment (by Mariusz Felisiak):
Replying to [comment:9 Alexander Lazarević]:
> So the THOUSAND_SEPARATOR seems to be the non-breaking-space (as
implemented) and not `single-quote` or `coma` (as in the PR), regardless
of plain numbers or monetary value.
This PR is not about values used by Django, it's about comments and docs.
Please check previous
[https://code.djangoproject.com/ticket/35095?replyto=9#comment:3
comments].
Django uses separators for **non-monetary numbers** i.e.
{{{#!python
DECIMAL_SEPARATOR = ","
THOUSAND_SEPARATOR = "\xa0" # non-breaking space
}}}
However, both docs and comments mention that for **monetary values**
format is different. The question is, should we change a comment to the:
> "For monetary numbers, the DECIMAL_SEPARATOR is a . (decimal point) and
the THOUSAND_SEPARATOR is **a , (comma).**"
or should we change docs to the:
> "For monetary values, a **single quote** is used as the thousand
separator and a decimal point for the decimal separator."
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:12>
Comment (by Andrea Angelini):
It seems that the official documentation pointed out by Alexander say that
a non-breaking space as thousand separator should be used for *any*
number, monetary values included.
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:13>
Comment (by Mariusz Felisiak):
If it's outdated, we can remove notes about `THOUSAND_SEPARATOR` for
monetary values from both docs and comments.
Claude, What do you think?
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:14>
* needs_better_patch: 1 => 0
* has_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:15>
Comment (by Claude Paroz):
Django has no way to differentiate formatting between monetary values and
other values. This formatting difference is a Swiss peculiarity, AFAIK. So
the current setting values are valid for most number, except monetary
values. I admit the comment is not very clear about that and could be
improved. By the way the `fr_CH` formats file could have the same comment,
as the situation is the same.
In my apps, I generally add an `|unlocalize` filter each time I have to
display a monetary value, so the `.` is used to format those numbers. This
solution is fine for Swiss-only apps, but fails in multi-country apps. We
could imagine implementing a special `monetary` filter/tag, but it looks
overkill if it's just for one country, considering that Swiss people will
also understand when a comma is used for monetary values, it's just not
the official way of printing them.
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:16>
Comment (by Alexander Lazarević):
Replying to [comment:12 Mariusz Felisiak]:
> This PR is not about values used by Django, it's about comments and
docs. Please check previous
[https://code.djangoproject.com/ticket/35095?replyto=9#comment:3
comments].
That was my understanding from the beginning and I commented accordingly
in the PR. Sorry for not being clear about that here.
> However, both docs and comments mention that for **monetary values**
format is different. The question is, should we change a comment to the:
> > "For monetary numbers, the DECIMAL_SEPARATOR is a . (decimal point)
and the THOUSAND_SEPARATOR is **a , (comma).**"
> or should we change docs to the:
> > "For monetary values, a **single quote** is used as the thousand
separator and a decimal point for the decimal separator."
Here I disagree, because from what I read in the referred official
document there is **no special thousand separator for monetary values**.
So my suggestion in the PR was to change the comment (and docs) to:
> "For monetary numbers, the DECIMAL_SEPARATOR is a . (decimal point)."
But maybe others can point me to the definition of a special thousand
separator for monetary values in the referred document? I wasn't able to
find one skimming the doc.
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:17>
Comment (by Alexander Lazarević):
Replying to [comment:16 Claude Paroz]:
> This formatting difference is a Swiss peculiarity, AFAIK.
And as far as I can tell there is also difference when formatting monetary
values given in Franken or Rappen. So it's **Fr. 15.40** but **0,13 Rp.**
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:18>
Comment (by Alexander Lazarević):
Well, on the other hand when I look at latest
/usr/share/i18n/locales/de_CH on my system, it seems to be outdated as
well and no help on the question:
{{{
...
date "2007-09-23"
...
LC_MONETARY
int_curr_symbol "CHF "
currency_symbol "CHF"
mon_decimal_point "."
mon_thousands_sep "<U2019>"
mon_grouping 3;3
positive_sign ""
negative_sign "-"
int_frac_digits 2
frac_digits 2
p_cs_precedes 1
p_sep_by_space 1
n_cs_precedes 1
n_sep_by_space 1
p_sign_posn 4
n_sign_posn 4
END LC_MONETARY
LC_NUMERIC
decimal_point "."
thousands_sep "<U2019>"
grouping 3;3
END LC_NUMERIC
}}}
With ' (U+2019 RIGHT SINGLE QUOTATION MARK)
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:19>
Comment (by Alexander Lazarević):
So finally I vote to change the comment from:
{{{
# these are the separators for non-monetary numbers. For monetary numbers,
# the DECIMAL_SEPARATOR is a . (decimal point) and the THOUSAND_SEPARATOR
is a
# , (comma).
}}}
to:
{{{
# These are the separators for non-monetary numbers.
# The decimal separator for monetary numbers is a . (decimal point), but
Django
# will always use DECIMAL_SEPARATOR for any number.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35095#comment:20>