Hi,

Why reset it at the end of your module?

Why not use ugettext_lazy everywhere?
from django.utils.translation import ugettext_lazy as _

(Disclaimer: I've never used translations before :)

Collin

On Saturday, January 24, 2015 at 3:46:31 AM UTC-5, Torsten Bronger wrote:
>
> Hallöchen! 
>
> This is not about where to use ugettext/ugettext_lazy.  I know 
> that.  :-) 
>
> But I was fed up with all those "_ = ugettext" scattered in my code 
> and tried to find a more systematic approach.  The following test 
> program runs through: 
>
>     ugettext = lambda x: x 
>     ugettext_lazy = lambda x: x 
>
>     _ = ugettext_lazy 
>
>     def function(): 
>         assert _ == ugettext 
>
>     class A(object): 
>         assert _ == ugettext_lazy 
>
>         def method(self): 
>             assert _ == ugettext 
>
>         assert _ == ugettext_lazy 
>
>     assert _ == ugettext_lazy 
>
>     def function_b(): 
>         assert _ == ugettext 
>
>     _ = ugettext 
>
>
>     function() 
>     function_b() 
>     a = A() 
>     a.method() 
>
> Do you think this is a good idea?  Simply setting _ to 
> ugetttext_lazy at the beginning of a module and to ugettext at the 
> end (and dealing with the very few remaining exceptions)?  How do 
> you do that? 
>
> Tschö, 
> Torsten. 
>
> -- 
> Torsten Bronger    Jabber ID: torsten...@jabber.rwth-aachen.de 
> <javascript:> 
>                                   or http://bronger-jmp.appspot.com 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/021586ad-9efd-4c31-949a-ed6f15fbf03b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to