开发者

Doesn't work django-localization

In settings:

USE_I18N = True
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware
.....

LANGUAGE_CODE = 'en_US'

django.mo compiled and has strings translate. I put django_lan开发者_Go百科guage=ru in cookies and django-admin become Russian. but my strings in _() in English. How I can get it work?


Are your string ins _() that are in english something that you added or is it from the default django install? If it is something you added you will need to build and compile your message files.

Have you followed these instructions?

https://docs.djangoproject.com/en/1.3/topics/i18n/localization/


Make sure you use gettext_lazy, not gettext:

from django.utils.translation import ugettext_lazy as _

Also make sure your strings aren't marked fuzzy in the translation file!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜