Re: [Django] #35389: stringformat filter in template breaks numeric localization

2024-04-18 Thread Django
#35389: stringformat filter in template breaks numeric localization
-+-
 Reporter:  Danic|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Template system  |  Version:  5.0
 Severity:  Normal   |   Resolution:  invalid
 Keywords:  locale,  | Triage Stage:
  localization   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * resolution:   => invalid
 * status:  new => closed

Comment:

 It's explicitly
 [https://docs.djangoproject.com/en/stable/ref/templates/builtins/#stringformat
 documented] that `stringformat`:

 > ''Formats the variable according to the argument, a **string formatting
 specifier**. This specifier uses the **printf-style String Formatting
 syntax**, with the exception that the leading “%” is dropped.''

 and in Python docs you will find that `.` is always used as a decimal
 separate. `localize/unlocalize` doesn't affect strings so everything works
 as expected.
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ef292e791-3271df28-3490-407c-9246-eeb7d352e43a-00%40eu-central-1.amazonses.com.


[Django] #35389: stringformat filter in template breaks numeric localization

2024-04-18 Thread Django
#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: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ef242ea45-40333a8f-5463-40e9-b482-c4177c7b3cac-00%40eu-central-1.amazonses.com.