[Tutor] django python Version 1.1.1 - Internacionalization

andré palma andrefsp at gmail.com
Thu Nov 12 05:10:29 CET 2009

Hi all! 
I'm developing a django web application but i'm having a trouble with
the internationalization.

The problem is that translation somehow doesn't work. 

i followed these steps: 

- on my project folder (./translation ) i run the command:
         "django-admin makemessages -l en-US" 

and it created the follow file with the right content:
inside the file it shows the messagesId's and the related messages
strings to fill with the translation. I was glad to see gettext is
        #: views.py:12
        msgid "benvindo"
        msgstr "welcome"

this messageID is related with this view: 
from django.utils.translation import ugettext as _
def translate1(request):
    output = _("benvindo")
    return HttpResponse(output)

#("code from djangobook")

- then i run "django-admin compilemessages" and so it has created the
binary file ./mysite/locale/en-US/LC_MESSAGES/django.mo, as i expected.

I think i already have my settings.py file configured and it looks like


# gettext settings for translation
ugettext = lambda s: s

    ('pt-PT', ugettext('Portuguese')),
    ('en-US', ugettext('English')),

USE_I18N = True


And it still isn't working =( 

I'm out of ideas... I've already googled it everywhere and i couldn't
find the solution. 

More information about the Tutor mailing list