I've got an app with the following translation settings:
# Language code for this installation. All choices can be found here:
#
http://www.i18nguy.com/unicode/language-identifiers.htmlLANGUAGE_CODE = 'nl-BE'
gettext = lambda s: s
LANGUAGES = (
('en', gettext('English')),
('nl', gettext('Dutch')),
)
MODELTRANSLATION_DEFAULT_LANGUAGE = 'nl'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.i18n",
"django.core.context_processors.debug",
"django.core.context_processors.media",
"django.core.context_processors.static",
"
django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages"
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
# i18n
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
In my templates I have several {% trans ".." %} tags I run ./manage.py makemessages -l en
processing language en
Which runs just fine. The generated file located at project/locale/en/LC_MESSAGES/django.po starts with the following:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-16 05:39-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: peltracom/settings.py:37
msgid "English"
msgstr ""
#: peltracom/settings.py:38
msgid "Dutch"
msgstr ""
#: qr_app/templates/product.html:14
msgid "Gemaakt van"
msgstr ""
#: qr_app/templates/product.html:15
msgid "Afkomstig uit"
msgstr ""
After editing the file and adding the correct translations I run:
/manage.py compilemessages -L EN processing file django.po in /Volumes/DATA/http/peltracom/locale/en/LC_MESSAGES
My base urls.py contains:
urlpatterns += i18n_patterns('',
url(r'', include('qr_app.urls')),
)
But when I point my browser to /en/some-url everything within trans template tags is displayed in Dutch and not in english. I even tried setting the accept-language header to en which didn't help at all.
Any clues on what might be going wrong here are welcome!