我有一个多语言网站(it、en、ru),它使用 django-cms 和一些挂在各个页面上的应用程序。我的问题是内容始终以意大利语提供,即使我访问以“/en/”或“/ru/”为前缀的页面。在我的基本模板 (base.html) 上,我有一个 {{ lang }} 模板变量,它允许我检索当前页面语言,它工作得很好......直到今天。现在,如果我访问wwww.myhomepage/en(或/ru),“lang”的值始终是“it”。
这些是我的语言设置(cms 而不是 cms)以及与语言相关的其他设置:
LANGUAGE_CODE = 'it'
DEFAULT_LANGUAGE = 0
LANGUAGES = (
('it', gettext(u'Italiano')),
('en', gettext(u'English')),
('ru', gettext(u'Russian')), )
CMS_LANGUAGES = (
('it', ugettext('Italian')),
('en', ugettext('English')),
('ru', ugettext('Russian')),
)
LOCALE_PATHS = (os.path.join(PROJECT_PATH, 'locale'))
CMS_LANGUAGE_CONF = {
'it': ['en'],
'ru': ['en'],
}
CMS_HIDE_UNTRANSLATED = False
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'cms.middleware.multilingual.MultilingualURLMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'cms.middleware.multilingual.MultilingualURLMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'cms.middleware.multilingual.MultilingualURLMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware'
)
有什么帮助吗?谢谢