Django allauth module comes with i18n'd templates and views that I would like to use to get my page displayed in French. However, only the text rendered with _() is correctly translated.
Inside the templates, the {% trans %}
and {% blocktrans %}
doesn't output translated text but {% get_current_language %}
returns the correct tag.
Settings sample :
USE_I18N = True
django.core.context_processors.i18n
TEMPLATES = [{
'BACKEND':'django.template.backends.django.DjangoTemplates',
'DIRS': ['mydir/templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.i18n',
'django.contrib.messages.context_processors.messages',
],
},
},
},]
LOCALE_PATHS = ['/abs/path/to/locale',]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'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',
]
LANGUAGE_CODE = 'fr'
LANGUAGES = ('fr',)
The template:
{% extends "account/base.html" %}
{% load i18n %}
...
{% trans "Signup" %}
...
abs/path/to/locale/fr/LC_MESSAGES/django.po, line 666-667 :
msgid "Signup"
msgstr "Inscription"
I'm out of ideas of where to look at, I tried restarting server and empty cache without success. Any help would be greatly appreciated.
EDIT: Problem solved by running python manage.py compilemessages
. Note to self : RTFM
Double check if you compiled files with translations.