add initial localization support for the front end #215

This commit is contained in:
jonaswinkler
2020-12-30 00:26:06 +01:00
parent 634b63628d
commit 05d4ca06fe
5 changed files with 26 additions and 5 deletions

View File

@@ -12,11 +12,11 @@
<meta name="full_name" content="{{full_name}}">
<meta name="cookie_prefix" content="{{cookie_prefix}}">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="{% static 'frontend/styles.css' %}"></head>
<link rel="stylesheet" href="{% static styles_css %}"></head>
<body>
<app-root>Loading...</app-root>
<script src="{% static 'frontend/runtime.js' %}" defer></script>
<script src="{% static 'frontend/polyfills.js' %}" defer></script>
<script src="{% static 'frontend/main.js' %}" defer></script>
<script src="{% static runtime_js %}" defer></script>
<script src="{% static polyfills_js %}" defer></script>
<script src="{% static main_js %}" defer></script>
</body>
</html>

View File

@@ -7,6 +7,7 @@ from django.conf import settings
from django.db.models import Count, Max, Case, When, IntegerField
from django.db.models.functions import Lower
from django.http import HttpResponse, HttpResponseBadRequest, Http404
from django.utils.translation import get_language
from django.views.decorators.cache import cache_control
from django.views.generic import TemplateView
from django_filters.rest_framework import DjangoFilterBackend
@@ -61,6 +62,10 @@ class IndexView(TemplateView):
context['cookie_prefix'] = settings.COOKIE_PREFIX
context['username'] = self.request.user.username
context['full_name'] = self.request.user.get_full_name()
context['styles_css'] = f"frontend/{get_language()}/styles.css"
context['runtime_js'] = f"frontend/{get_language()}/runtime.js"
context['polyfills_js'] = f"frontend/{get_language()}/polyfills.js"
context['main_js'] = f"frontend/{get_language()}/main.js"
return context