[Django] #20601: intcomma and floatvalue internationalization error

162 views
Skip to first unread message

Django

unread,
Jun 14, 2013, 11:46:12 AM6/14/13
to django-...@googlegroups.com
#20601: intcomma and floatvalue internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: 1.5
Component: Python 2 | Keywords: internationalization,
Severity: Normal | humanize, contrib, float,
Triage Stage: Unreviewed | floatcomma
Easy pickings: 0 | Has patch: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
When u use floatvalue "2" and intcomma together in a template the output
of intcomma won't be internationalized.

Since intcomma wont work with decimals in django 1.5.1 i tried to convert
a decimal to a float in a template, but it wont give me the excepted
output.
When i have the value of 1000.11 it should be 1000,11 in germany, with
intcomma(float(1000,11)) i get 1.000,11. But when i use
Decimal(1000,11)|floatvalue"2"|intcomma, i will get 1,000,11. Thats a bug
or maybe an unwanted behavior.

--
Ticket URL: <https://code.djangoproject.com/ticket/20601>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 14, 2013, 11:47:05 AM6/14/13
to django-...@googlegroups.com
#20601: intcomma and floatvalue internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: 1.5
Component: Python 2 | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
internationalization, humanize, | Needs documentation: 0
contrib, float, floatcomma | Patch needs improvement: 0

Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by merb):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:1>

Django

unread,
Jun 14, 2013, 11:47:15 AM6/14/13
to django-...@googlegroups.com
#20601: intcomma and floatvalue internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: 1.5
Component: Python 2 | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
internationalization, humanize, | Needs documentation: 0
contrib, float, floatcomma | Patch needs improvement: 0

Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by merb):

* cc: merb (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:2>

Django

unread,
Jun 14, 2013, 11:47:27 AM6/14/13
to django-...@googlegroups.com
#20601: intcomma and floatvalue internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: merb
Type: | Status: assigned
Cleanup/optimization | Version: 1.5

Component: Python 2 | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
internationalization, humanize, | Needs documentation: 0
contrib, float, floatcomma | Patch needs improvement: 0

Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by merb):

* status: new => assigned
* owner: nobody => merb


--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:3>

Django

unread,
Jun 14, 2013, 2:34:19 PM6/14/13
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: merb
Type: | Status: assigned
Cleanup/optimization | Version: 1.5

Component: Python 2 | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
internationalization, humanize, | Needs documentation: 0
contrib, float, floatcomma | Patch needs improvement: 0

Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:4>

Django

unread,
Jun 14, 2013, 2:35:08 PM6/14/13
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: merb
Type: | Status: assigned
Cleanup/optimization | Version: 1.5

Component: Python 2 | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
internationalization, humanize, | Needs documentation: 0
contrib, float, floatcomma | Patch needs improvement: 0

Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by merb):

Replying to [ticket:20601 c.schmitt@…]:


> When u use floatvalue "2" and intcomma together in a template the output
of intcomma won't be internationalized.
>
> Since intcomma wont work with decimals in django 1.5.1 i tried to
convert a decimal to a float in a template, but it wont give me the
excepted output.
> When i have the value of 1000.11 it should be 1000,11 in germany, with
intcomma(float(1000,11)) i get 1.000,11. But when i use
Decimal(1000,11)|floatvalue"2"|intcomma, i will get 1,000,11. Thats a bug
or maybe an unwanted behavior.

i meant floatformat not floatvalue.

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:5>

Django

unread,
Jun 14, 2013, 3:27:21 PM6/14/13
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: merb
Type: | Status: assigned
Cleanup/optimization | Version: 1.5

Component: Python 2 | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
internationalization, humanize, | Needs documentation: 0
contrib, float, floatcomma | Patch needs improvement: 0

Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by merb):

This is the actual humanize function:

{{{
@register.filter(is_safe=True)
def intcomma(value, use_l10n=True):
"""
Converts an integer to a string containing commas every three digits.
For example, 3000 becomes '3,000' and 45000 becomes '45,000'.
"""
if settings.USE_L10N and use_l10n:
try:
if not isinstance(value, float):
value = int(value)
except (TypeError, ValueError):
return intcomma(value, False)
else:
return number_format(value, force_grouping=True)
orig = force_text(value)
new = re.sub("^(-?\d+)(\d{3})", '\g<1>,\g<2>', orig)
if orig == new:
return new
else:
return intcomma(new, use_l10n)
}}}


The problem is that floatformat returns a SafeText type, so it isn't a
instance of float and intcomma gets recalled with use_l10n=False. So this
line gets called:

{{{
new = re.sub("^(-?\d+)(\d{3})", '\g<1>,\g<2>', orig)
}}}

This line will add an , to every 3rd place on the SafeText type so a
string of:
1000,11 or 1000000,11 will be
1,000,11 or 1,000,000,11 which could get converted to an integer, so the
next time intcomma gets called, it thinks that the SafeText type could now
get converted to an integer and will then return himself.
So this will be an uncorrect return value

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:6>

Django

unread,
Jun 14, 2013, 3:32:32 PM6/14/13
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: merb
Type: Bug | Status: assigned
Component: Python 2 | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage:
internationalization, humanize, | Unreviewed
contrib, float, floatcomma | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by merb):

* type: Cleanup/optimization => Bug


--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:7>

Django

unread,
Jun 14, 2013, 3:32:38 PM6/14/13
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner:
Type: Bug | Status: new

Component: Python 2 | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage:
internationalization, humanize, | Unreviewed
contrib, float, floatcomma | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by merb):

* status: assigned => new
* owner: merb =>


--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:8>

Django

unread,
Jun 15, 2013, 5:50:59 AM6/15/13
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner:
Type: New feature | Status: new
Component: Template system | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

internationalization, humanize, | Needs documentation: 0
contrib, float, floatcomma | Patch needs improvement: 0

Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by claudep):

* type: Bug => New feature
* component: Python 2 => Template system
* stage: Unreviewed => Accepted


Comment:

Basically, the issue is that both `intcomma` and `floatformat` take
numbers (or number-convertible values) to output a string representation.
So chaining them is basically broken. One strategy would be to try harder
to make those string representation transformed back to numbers, but then
the first transformation would be lost.

I'm of the opinion that either one of these filters should be able to do
all necessary transformations. For example, we could imagine that the
`floatformat` argument takes an optional `g` suffix to indicate grouping.
So the result of `Decimal(1000,11)|floatvalue:"2g"` would be 1.000,11 for
German (i.e. `numberformat` would be passed `force_grouping=True` in
`floatformat` filter).

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:9>

Django

unread,
Jun 15, 2013, 12:50:42 PM6/15/13
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner:

Type: New feature | Status: new
Component: Template system | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, humanize, | Needs documentation: 0
contrib, float, floatcomma | Patch needs improvement: 0

Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by merb):

wouldn't it be better to make them type safe? Like raise an error if
intcomma or floatformat won't get 'numbers' or 'localized_numbers'?

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:10>

Django

unread,
May 13, 2017, 3:10:37 PM5/13/17
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: (none)

Type: New feature | Status: new
Component: Template system | Version: 1.10

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, humanize, |
contrib, float, floatcomma |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Petr Dlouhý):

* version: 1.5 => 1.10


Comment:

This is still problem in Django 1.10.

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:11>

Django

unread,
Feb 28, 2018, 6:45:30 AM2/28/18
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------

Reporter: c.schmitt@… | Owner: (none)
Type: New feature | Status: new
Component: Template system | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, humanize, |
contrib, float, floatcomma |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alexey):

* cc: Alexey (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:12>

Django

unread,
Feb 28, 2018, 7:06:42 AM2/28/18
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------

Reporter: c.schmitt@… | Owner: (none)
Type: New feature | Status: new
Component: Template system | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, humanize, |
contrib, float, floatcomma |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Alexey):

Should we try to parse value to float?

Something like try to find float separator with regex, and convert it
before `isinstance` check

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:13>

Django

unread,
Aug 8, 2019, 7:29:16 AM8/8/19
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------

Reporter: c.schmitt@… | Owner: (none)
Type: New feature | Status: new
Component: Template system | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, humanize, |
contrib, float, floatcomma |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Ron):

For the specific German case a fix:

`'|'.join(intcomma(floatformat(amount, 2)).rsplit(',', 1)).replace(',',
'.').replace('|', ',')`

Maybe this helps anybody...

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:14>

Django

unread,
Sep 27, 2019, 9:38:49 AM9/27/19
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Ram
| Parameswaran
Type: New feature | Status: assigned
Component: Template system | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, humanize, |
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* owner: (none) => Ram Parameswaran


* status: new => assigned

* has_patch: 0 => 1
* version: 1.10 => master


Comment:

[https://github.com/django/django/pull/11834 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:15>

Django

unread,
Sep 27, 2019, 11:00:12 AM9/27/19
to django-...@googlegroups.com
#20601: intcomma and floatformat internationalization error
-------------------------------------+-------------------------------------

Reporter: c.schmitt@… | Owner: Ram
| Parameswaran
Type: New feature | Status: assigned
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, humanize, |
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:16>

Django

unread,
Oct 11, 2020, 11:49:46 PM10/11/20
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatvalue to intcomma in some locales
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls

Type: New feature | Status: assigned
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, humanize, |
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0


Comment:

[https://github.com/django/django/pull/13528 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:18>

Django

unread,
Oct 12, 2020, 9:53:16 AM10/12/20
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatvalue to intcomma in some locales
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls
Type: New feature | Status: assigned
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, humanize, |
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0


Comment:

Addressed reviews.

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:20>

Django

unread,
Oct 13, 2020, 4:39:06 AM10/13/20
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatvalue to intcomma in some locales
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls
Type: New feature | Status: assigned
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
internationalization, humanize, | checkin

contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:21>

Django

unread,
Oct 13, 2020, 8:32:17 AM10/13/20
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatformat to intcomma in some locales

-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls
Type: New feature | Status: assigned
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
internationalization, humanize, | checkin
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:22>

Django

unread,
Oct 13, 2020, 2:40:00 PM10/13/20
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatformat to intcomma in some locales
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls
Type: New feature | Status: closed

Component: Template system | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
internationalization, humanize, | checkin
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"ac6c4260074de43a978e5c6553ef89441e1d6748" ac6c426]:
{{{
#!CommitTicketReference repository=""
revision="ac6c4260074de43a978e5c6553ef89441e1d6748"
Fixed #20601 -- Allowed forcing format with thousand separators in
floatformat filter.

Thanks Claude Paroz and Nick Pope for reviews.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:23>

Django

unread,
Jan 6, 2022, 6:21:26 AM1/6/22
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatformat to intcomma in some locales
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls
Type: New feature | Status: closed
Component: Template system | Version: dev

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
internationalization, humanize, | checkin
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Cassiano R. N. dos Santos):

Is this fixed for Django 2.2

Doing
{{{
{{ variable | intcomma | floatformat:2 }}
}}}
or
{{{
{{ variable | floatformat:2 | intcomma }}
}}}
does not work.

In the first case results broken, and in second, gives, e.g. 1,000,00 when
the correct would be 1.000,00 for pt-BR (brazilian portuguese).

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:24>

Django

unread,
Jan 6, 2022, 6:50:47 AM1/6/22
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatformat to intcomma in some locales
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls
Type: New feature | Status: closed
Component: Template system | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
internationalization, humanize, | checkin
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:24 Cassiano R. N. dos Santos]:
> Is this fixed for Django 2.2?

No, it's fixed in Django 3.2+.

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:25>

Django

unread,
Jan 27, 2022, 5:35:47 AM1/27/22
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatformat to intcomma in some locales
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls
Type: Bug | Status: closed
Component: Template system | Version: 4.0

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
internationalization, humanize, | checkin
contrib, float, floatcomma |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Cassiano R. N. dos Santos):

* cc: Cassiano R. N. dos Santos (added)
* has_patch: 1 => 0
* version: dev => 4.0
* type: New feature => Bug


Comment:

I'm just trying the fix in Django 4.0.1 with both


{{{
{{ variable | intcomma | floatformat:2 }} {# breaks template #}
}}}


and


{{{
{{ variable | floatformat:2 | intcomma }} {# results i.e., 10,123,00
(would be 10.123,00) #}
}}}

But the bug persists.

In my settings.py:


{{{
LANGUAGE_CODE = 'pt-BR'
USE_I18N = True
USE_L10N = True
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:26>

Django

unread,
Jan 27, 2022, 6:46:33 AM1/27/22
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatformat to intcomma in some locales
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls
Type: New feature | Status: closed

Component: Template system | Version: 4.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
internationalization, humanize, | checkin
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 0 => 1

* type: Bug => New feature


Comment:

Replying to [comment:26 Cassiano R. N. dos Santos]:
> But the bug persists.

I don't see the "g" suffix in your example. Also in Django 4.0 the
`floatformat` template filter no longer depends on the `USE_L10N` setting
and always returns localized output. Have you tried `{{ variable |
floatformat:"2g" }}`?

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:27>

Django

unread,
Jan 27, 2022, 7:32:07 AM1/27/22
to django-...@googlegroups.com
#20601: Incorrect separators when chaining floatformat to intcomma in some locales
-------------------------------------+-------------------------------------
Reporter: c.schmitt@… | Owner: Jacob
| Walls
Type: New feature | Status: closed
Component: Template system | Version: 4.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
internationalization, humanize, | checkin
contrib, float, floatcomma |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Cassiano R. N. dos Santos):

Oh, that was it. It was missing the "2g". Thank you very much.

--
Ticket URL: <https://code.djangoproject.com/ticket/20601#comment:28>

Reply all
Reply to author
Forward
0 new messages