python - django locale can't translate depend on accept-language -
here settings
languages = ( ('zh_cn', u'简体中文'), ('en-us', u'english'), ) language_code = 'en-us' use_i18n = true use_l10n = true middleware_classes = ( 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.locale.localemiddleware', 'corsheaders.middleware.corsmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', # "django.middleware.cache.cachemiddleware", "django.middleware.transaction.transactionmiddleware", )
here print
('django_language', '') ('cookies', '') ('accept_language', 'zh_cn') ('language_code', 'en-us')
my django version 1.5.4
if set
request.session['django_language'] = 'zh_cn'
i translation next time. what's wrong ?
Comments
Post a Comment