Description

I try to test ​http://www.djangoproject.com/documentation/i18n/ but it does not work for win32. If I add. I created all correct .po & .mo files . Django always displays the content of msgid instead of msgstr. I tried (according to mentioned manual) the following code to settings.py file:

LANGUAGES = (
('de', _('German')),
('en', _('English')),
)

But... after that I have problems with starting the server:

D:\i18n-test\myproject>python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 4, in ?
import settings # Assumed to be in the same directory.
File "D:\i18n-test\myproject\settings.py", line 72, in ?
LANGUAGES = (
NameError: name '_' is not defined

Change History (2)

I18n does work. The problem you see is caused by an import loop:
you should not import any django modules in your settings file
since many of them depend on your project settings in some way.

The LANGUAGES tuple is created in django's global_settings.py file
and that that seems to be the only place you can add more languages.
For 'de' and any languages from ​this list
you do not need to change a thing, just set LANGUAGE_CODE to 'de' or
add LocaleMiddleware to your MIDDLEWARE_CLASSES and use it to set the
preferred language.