On Mon, Apr 13, 2009 at 3:07 PM, drakkan <drakkan1...@gmail.com> wrote:

>
> The string that doesn't works are defined in models.py:
>
> STATUS=(
>    (1,_('Active')),
>    (0,_('Inactive')),
> )
>
> class TestModel(models.Model):
>    status=models.IntegerField("Status",choices=STATUS,default=1)
>
> in my view I have:
>
> 'status':u.get_status_display()
>
> ant this is not transalted, why?
>
> On 13 Apr, 19:11, drakkan <drakkan1...@gmail.com> wrote:
> > Hi, I'm trying to use i18n with django. I followed the docs and
> > created my transalations for english,italian and spanish
> >
> > in settings I have:
> >
> > ugettext = lambda s: s
> >
> > LANGUAGES = (
> >     ('en', ugettext('English')),
> >     ('it', ugettext('Italian')),
> >     ('es', ugettext('Spanish')),
> > )
> >
> > and I installed the locale middleware
> >
> > MIDDLEWARE_CLASSES = (
> >     'django.contrib.csrf.middleware.CsrfMiddleware',
> >     'django.contrib.sessions.middleware.SessionMiddleware',
> >     'django.middleware.common.CommonMiddleware',
> >     'django.contrib.auth.middleware.AuthenticationMiddleware',
> >     'django.middleware.locale.LocaleMiddleware',
> >     'django.middleware.doc.XViewMiddleware',
> > )
> >
> > If I change the settings:
> >
> > LANGUAGE_CODE
> >
> > all is fine both javascript and coded string are correctly transalted.
> >
> > If I comment LANGUAGE_CODE settings and change the browser language
> > preference only javascript is correctly translated. I have the same
> > issue if I change
> >
> > request.LANGUAGE_CODE
> >
> > or
> >
> > request.session[settings.LANGUAGE_COOKIE_NAME]
> >
> > so the problem seems related to locale middleware.
> >
> > Someone with the same issue? Is this a django bug or a my
> > misconfiguration?
> >
> > thanks
> > drakkan1000
> >
>
Are you using ugettext or ugettext_lazy?  You need to be using the lazy
variant there.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to