What import are you aliasing as _?
You have three options for gettext calls:
- ugettext, which translates as soon as it's *called*.
- ugettext_lazy, which does not translate until the attribute is
*accessed*.
- ugettext_noop, which translates at the last possible moment, such as
when the value is *rendered*.
For your case, you probably want to be using ugettext_lazy:
from django.utils.translation import ugettext_lazy as _
If that doesn't fix the problem, try using ugettext_noop.
On Jul 25, 2:54 am, "Peter Melvyn" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm trying to embed login form into each page. I implemented it using
> new forms as inclusion tag. Form model looks like:
> ...
> sf_name = forms.CharField(required=True, label=_('Username:'),
> max_length=30, widget=forms.TextInput(attrs={'class':'wsu-login-edit'}))
> ...
>
> If I change language by setting session['django-language'], page is
> re-rendered correctly using the new language, except labels defined in
> form model (texts translated in underlying inclusion template are
> OK).
> When re-rendering page, form is instantiated again, but texts in
> labels does not correspond to current
> request.session['django-language'] value. I tried to trace Django-code
> down, but I was lost somewhere in copy.py
>
> #
>
> Having this written, I got an idea to test another new form instances
> and it seems that those instances do not work as well i.e. instance
> does not translate labels if language is session changed is changed.
>
> #
>
> Please, could anybody advise me, what I'm missing?
>
> Thank, Peter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---