Add lang attribute to <html> tag in presale

This commit is contained in:
Raphael Michel
2020-03-08 15:23:47 +01:00
parent 79ecb231f2
commit 23a52eb12a
3 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
from django.conf import settings
from django.core.files.storage import default_storage
from django.utils import translation
from django.utils.translation import get_language_info
from django_scopes import get_scope
from i18nfield.strings import LazyI18nString
@@ -92,6 +93,7 @@ def contextprocessor(request):
ctx['js_date_format'] = get_javascript_format_without_seconds('DATE_INPUT_FORMATS')
ctx['js_time_format'] = get_javascript_format_without_seconds('TIME_INPUT_FORMATS')
ctx['js_locale'] = get_moment_locale()
ctx['html_locale'] = translation.get_language_info(translation.get_language()).get('public_code', translation.get_language())
ctx['settings'] = pretix_settings
ctx['django_settings'] = settings

View File

@@ -5,7 +5,7 @@
{% load statici18n %}
{% load thumb %}
<!DOCTYPE html>
<html{% if rtl %} dir="rtl" class="rtl"{% endif %}>
<html{% if rtl %} dir="rtl" class="rtl"{% endif %} lang="{{ html_locale }}">
<head>
<title>{% block thetitle %}{% endblock %}</title>
{% if css_file %}

View File

@@ -440,13 +440,15 @@ EXTRA_LANG_INFO = {
'bidi': False,
'code': 'de-informal',
'name': 'German (informal)',
'name_local': 'Deutsch'
'name_local': 'Deutsch',
'public_code': 'de',
},
'nl-informal': {
'bidi': False,
'code': 'nl-informal',
'name': 'Dutch (informal)',
'name_local': 'Nederlands'
'name_local': 'Nederlands',
'public_code': 'nl',
},
'fr': {
'bidi': False,