#19132: bug in use of mark_safe and i18n _
--------------------------------------+------------------------------------
     Reporter:  flagzeta@…            |                    Owner:  nobody
         Type:  Bug                   |                   Status:  reopened
    Component:  Internationalization  |                  Version:  1.4
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by claudep):

 * status:  closed => reopened
 * resolution:  invalid =>
 * component:  Translations => Internationalization
 * stage:  Unreviewed => Accepted


Comment:

 No, even with ugettext_lazy, this does not work. mark_safe is triggering
 lazy string translation.

 {{{
 >>> from django.utils.translation import ugettext_lazy
 >>> from django.utils.safestring import mark_safe
 >>> mark_safe(ugettext_lazy('Home'))
 u'Home'
 >>> mark_safe(ugettext_lazy('Home')).__class__
 <class 'django.utils.safestring.SafeText'>
 }}}

 I don't know currently if we can do something to prevent this, but a
 temporary workaround would be to dynamically set the help_text property in
 the `__init__` of the form.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19132#comment:2>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to