#32272: gettext_lazy inconsistent error when nested
--------------------------------------+------------------------------------
     Reporter:  John Bazik            |                    Owner:  nobody
         Type:  Bug                   |                   Status:  new
    Component:  Internationalization  |                  Version:  3.1
     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
--------------------------------------+------------------------------------

Comment (by John Bazik):

 Although {{{gettext_lazy}}} is, as you mention, set in {{{trans_null.py}}}

 {{{
 gettext_noop = gettext_lazy = _ = gettext
 }}}

 It is also set in {{{translation/__init__.py}}}, and that's what gets
 imported.

 {{{
 _trans = Trans()


 def gettext(message):
     return _trans.gettext(message)


 gettext_lazy = lazy(gettext, str)
 }}}

 In {{{class Trans}}}, at the top of that file, {{{_trans.gettext}}} is set
 to {{{trans_null.gettext}}}, which is this


 {{{
 def gettext(message):
     return message
 }}}

 I skipped all that in my example to keep it simple.  Coercing the message,
 as you suggest, looks like a good solution to me.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32272#comment:4>
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/064.f2d5431e47b74f7f9e9c5c518a083384%40djangoproject.com.

Reply via email to