Django: Only a single element gets translated
Porting a Django site from 1.2 to 1.5 on Python 2.6 i ran into problems
with internationalization.
The wierd thing is that only one string gets translated in the entire
site. Other strings located in the same template doesn't get translated,
and all translations are located in a single po/mo file. All translations
are there, verified with Poedit and compiled with manage.py
compilemessages.
While trying things to get it to work I cleared the LOCALE_PATH, restarted
the dev server (manage.py runserver), cleared any browser cache (even
though meta-data for the site disables cashing), lo and behold the element
is still translated. I verified this by adding the same text again after,
and it still gets translated, so no client side caching is involved.
Language switching works as expected and the only translated element is
changed to the default language, {{ LANGUAGE_CODE }} confirms this. I've
tried clearing the session data and django cache (which doesn't seem to be
used by the dev server).
Can someone guess what's going on here?
Relevant settings:
USE_I18N = True
USE_L10N = True
LANGUAGES = (
('en', 'English'),
('foo', 'Fooo'),
)
LANGUAGE_CODE = 'en'
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
)
LOCALE_PATH = ('/path/to/my/locale',)
For reference, these questions didn't help me:
django internationalization and translations problem
Django not translating the site properly
Django i18n does not work
No comments:
Post a Comment