I am trying to make some translations using the i18n. I have imported some libraries in my TEMPLATES in the setting.py file.
The problem is that if I import django.core.context_processors.i18n my Iapp shows an error and it wont work.
my TEMPLATES in settings.py file
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', #i18n
],
},
},
]
If I import the last line my app shows this error:
ModuleNotFoundError at /myapp2/ No module named 'django.core.context_processors'
Thank you in advance
In newer versions of django this should be django.template.context_processors.i18n
. See https://docs.djangoproject.com/en/3.0/ref/templates/api/#django-template-context-processors-i18n