Opened 6 years ago

Closed 6 years ago

#17621 closed Bug (worksforme)

django.utils.translation.activate() issue

Reported by: tomasz.zawadzinski@… Owned by: nobody
Component: Internationalization Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


django.utils.translation.activate() doesn't affect on form instances. Strings defined in a class of form (ex label, error_messages etc), are translated only in a result of setting a proper cookie or session key.

Change History (3)

comment:1 Changed 6 years ago by Claude Paroz

Please provide us with real code so as we can judge if the problem is in Django or on your side. Did you use ugettext_lazy to mark form class strings for translation?

comment:2 in reply to:  1 Changed 6 years ago by anonymous

I'm sorry, everything is fine using ugettext_lazy. I don't know if this problem is worth solving anymore.

code looked like this (other strings were translated properly, these in templates and other helping functions):

from django.utils.translation import ugettext as _

class BookingForm(forms.Form):
   name = forms.CharField(max_length=25, label=_(u'Imię'), error_messages={'required': _(u'Proszę wpisać imię.')})

def index(request, lang=''):
   if lang == 'en':
   elif lang == 'pl':

   c = {'form': BookingForm()}

comment:3 Changed 6 years ago by Aymeric Augustin

Resolution: worksforme
Status: newclosed

This is exactly the reason why ugettext_lazy exists :)

Note: See TracTickets for help on using tickets.
Back to Top