#33440: Cannot escape % character when using gettext().
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: nobody
Type: Uncategorized | Status: closed
Component: | Version: 3.2
Internationalization |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* cc: Claude Paroz, Ramiro Morales (added)
* resolution: => invalid
* status: new => closed
* component: Uncategorized => Internationalization
Comment:
#11240 is about a similar issue but with `{% translate %}` template tag.
The main difference is that by design we don't support %-formatting in `{%
translate %}` (see [https://code.djangoproject.com/ticket/11240#comment:16
comment]), which is not the case in `gettext()`. `gettext()` supports
`%-formatting` and `%o` is a valid conversion type (signed octal value) so
there is not much we can do. I'd recommend to remove `50%` from translated
string (it's not something that will change in different languages), e.g.
{{{
gettext('This item is %(discount)s off!') % {'discount': '50%'}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33440#comment:1>
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/069.705de6841d1e4bccd3d9b71090d1bc37%40djangoproject.com.