#35389: stringformat filter in template breaks numeric localization
-------------------------------------+-------------------------------------
               Reporter:  Danic      |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Template   |        Version:  5.0
  system                             |       Keywords:  locale,
               Severity:  Normal     |  localization
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 The stringformat filter breaks the numeric localization in the template.

 With these settings

 {{{
 LANGUAGES = [
     ("de", _("German")),
     ("en", _("English")),
 ]
 LANGUAGE_CODE = "de"
 TIME_ZONE = "Europe/Berlin"
 USE_I18N = True
 USE_TZ = True
 }}}

 the following template

 {{{
 {{ 3.14 }}
 {{ 3.14 | localize }}
 {{ 3.14 | unlocalize }}
 {{ 3.14159265359 | stringformat:".2f" }}
 {{ 3.14159265359 | stringformat:".2f" | localize }}
 {{ 3.14159265359 | stringformat:".2f" | unlocalize }}
 }}}


 Should print

 {{{
 3,14
 3,14
 3.14
 3,14
 3,14
 3.14
 }}}

 but factually prints

 {{{
 3,14
 3,14
 3.14
 3.14 <--
 3.14 <--
 3.14
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35389>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ef242ea45-40333a8f-5463-40e9-b482-c4177c7b3cac-000000%40eu-central-1.amazonses.com.

Reply via email to