On Mon, Oct 13, 2008 at 12:37 AM, Chuck Bai2 <[EMAIL PROTECTED]> wrote:
> > The base language of my site is Chinese. I want to change to English > when user select language perferrence. > > In my base.html, I have > {% trans "产品" %} > > I generated django.po file using > django-admin.py makemessages -l en > > In django.po file of en locale, > #: .\templates\base.html.py:36 > msgid "å…¬å ¸äº§å" " > msgstr "Products" > > As you can see, the generated msgid is scrambled and invalid. This > caused translation failed. If I manually changed the msgid to be > msgid "产品" > msgstr "Products" > > The translation works. I verified that my base.html is utf-8 encoded. > Anyone know what is the reason for the scrambled msgid in django.po > file? I suspect this is an encoding issue on makemessages command, but > don't know how to resolve this. > You don't mention your system type but given the backslashes in the path name I'm guessing Windows. In which case it's likely you are hitting this: http://code.djangoproject.com/ticket/9212 (Even if you are not running Windows you could hit this if your gettext package is earlier than 0.15. Look at the output of 'xgettext --version' to see if this is what you are hitting. If it's lower than 0.15 then this is likely the problem.) The bug is in xgettext and was fixed in xgettext 0.15. Unfortunately the most-easily installed gettext utilities binaries for Windows are older than that. Therefore we put a fix into Django to work around the xgettext bug, but this problem was reported after 1.0 was shipped so you'll have to run with a 1.0.X branch or trunk checkout in order to get it. Alternatively you could install a gettext package that is 0.15 level or higher (the one that cygwin installs, for example, does not have this problem). Karen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---