我很难让 i118 工作。调用我的 html 时,我得到:
Failed lookup for key [LANGUAGES] in u"[{'projects': [<Project: etwas>]}]"
这是我的工作流程:
#setting.py
LANGUAGE_CODE = 'de'
ugettext = lambda s: s
LANGUAGES = (
('de', ugettext('German')),
('en', ugettext('English')),
('pt', ugettext('Portuges')),
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
#...
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'django.core.context_processors.i18n',
)
#base.html
{% load i18n %}
<html>
<body>
<form action="/i18n/setlang/" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="next/page" />
<select name="language">
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}">{{ language.name_local }} ({{ language.code }})</option>
{% endfor %}
#projects.html
{% extends 'base.html' %}
{% load i18n %}
{% block content %}
{% for p in projects %}
<h1>{{ p.title_en }}</h1>
<p>{{ p.body_de }} </p>
<p>{{ p.body_pt }} </p>
<hr>
{% endfor %}
{% endblock %}
我错过了什么?我在网上找不到有关错误消息的任何有用信息。