I'm trying to internationalize my django app but I'm stuck.
I tried to translate some strings for testing purpose and it succeed but now even if I edit the .po files and compile to create .mo files it still translate just like the first test with the first test values on the first test strings. I don't know why, i've been searching for days.
here is my settings.py middleware part :
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.middleware.locale.LocaleMiddleware',
)
the context processors part :
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.i18n',
],
},
},
]
and the internationalization part :
LANGUAGE_CODE = 'en-gb'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LOCAL_PATHS = (
os.path.join(BASE_DIR, 'locale/'), #BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
LANGUAGES = (
('fr', _('French')),
('en', _('English')),
)
There is a 'locale' directory at the root of my project, (i've already tried to put the absolute path in my LOCAL_PATHS).
.po files are generated by "python manage.py makemessages -l en -l fr -e djhtml -e py" at 'my/project/locale/lang[en or fr]/LC_MESSAGES/django.po' and .mo files are generated by "python manage.py compilemessages" at 'my/project/locale/lang[en or fr]/LC_MESSAGES/django.mo'.
I tried to clean the cache, restart the server (the runserver thing), but it still doesn't take into account any modifications on .po files.
Thank you for helping me.
It's
LOCALE_PATHS
, not LOCAL (link).