Ticket is #3877. I did not found a way to assign the ticket to you Malcom.
It has been assigned to Hugo. On 30 mar, 08:53, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-03-30 at 01:43 -0700, olive wrote: > > Hello, > > > Here is how I define a form in my views: > > > class MyForm(forms.Form): > > name = forms.CharField(label=_('Name')) > > ... > > > The problem is _('Name') is translated when I restart the server > > (Django or Apache), > > but not when I switch the browser locale. > > > I tried both > > from django.utils.translation import gettext_lazy as _ > > and > > from django.utils.translation import gettext as _ > > > Any idea ? > > I would hazard a guess (and I may be wrong and thus doing Adrian a > disservice) that i18n support for newforms has not been completely > though through yet. There seem to be a couple of places in the code that > need some i18n support put in. > > As a general rule, any code that is executed when a file is imported > should be using gettext_lazy as the translation function. This would > include things like the class attributes you are defining in your > example. A consequence of this is that the code which uses those strings > needs to call gettext() on the string in order to force the translation. > Right at this moment, newforms does not do the gettext call. So you > problem is not completely solvable without a bugfix in Django. > > If you could file a ticket about this and put it in the > internationalisation component -- even assign it to me (I am mtredinnick > in Trac) -- we won't forget about it and I'll make sure we get the right > hooks in the code. > > Regards, > Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---