预期的行为将是以FR作为HTTP标头中第一个设置的新来访者应看到该页面的法语版本(已存在并在设置中设置为语言,但未设置为默认语言) 。手动语言开关正在工作)。
应按照以下顺序确定Django文档语言
实际行为正确地将导航节点(django cms菜单)切换为法语,而不是cms插件内容(以默认语言显示)。
#MIDDLEWARE SETTINGS (order as mentioned in docs)
'cms.middleware.utils.ApphookReloadMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'webpack.middleware.WebpackDevserverMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.admindocs.middleware.XViewMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
##################################################################
# multisite language handling
##################################################################
AVAILABLE_LANGUAGES = {
'de': _('Deutsch'),
'fr': _('Französisch'),
'it': _('Italiano'),
'en': _('English'),
}
SITE_LANGUAGES = config('SITE_LANGUAGES', default='de,fr', cast=Csv())
LANGUAGE_CODE = SITE_LANGUAGES[0]
LANGUAGES = [(k, v) for k, v in AVAILABLE_LANGUAGES.items() if k in SITE_LANGUAGES]
如果设置了SITE_LANGUAGES,是否需要CMS_LANGUAGES。在Django CMS中,页面树中的所有相关选项均可用。如果设置,我看不到任何其他行为。
任何想法会导致这种行为吗?