Add language code to template context

To fix a pa11y error, we need to get the Django settings LANGUAGE_CODE
into the template context so it can get rendered in the <html> element.
This commit is contained in:
Neil Martinsen-Burrell 2022-09-13 13:45:51 -05:00
parent 5bdd01138c
commit 13a310f354
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
2 changed files with 6 additions and 0 deletions

View file

@ -158,6 +158,7 @@ TEMPLATES = [
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"registrar.context_processors.language_code",
],
},
},

View file

@ -0,0 +1,5 @@
from django.conf import settings
def language_code(request):
"""Add LANGUAGE_CODE to the template context."""
return {"LANGUAGE_CODE": settings.LANGUAGE_CODE}