diff --git a/publichealth/home/templates/tags/language.html b/publichealth/home/templates/tags/language.html new file mode 100644 index 0000000..dc5963f --- /dev/null +++ b/publichealth/home/templates/tags/language.html @@ -0,0 +1,3 @@ +{% for lang in languages %} + {{ lang.title }} +{% endfor %} diff --git a/publichealth/home/templatetags/navigation.py b/publichealth/home/templatetags/navigation.py new file mode 100644 index 0000000..1072742 --- /dev/null +++ b/publichealth/home/templatetags/navigation.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +from django import template +from django.utils import translation + +register = template.Library() + +# Language switcher +@register.inclusion_tag('home/templates/tags/language.html', takes_context=True) +def language_switcher(context): + return { + 'languages': [ { 'code': 'de', 'title': 'De' }, { 'code': 'fr', 'title': 'Fr' } ], + 'currentlangcode': translation.get_language(), + 'request': context['request'], + } diff --git a/publichealth/templates/header.html b/publichealth/templates/header.html index 1a3d204..ef56726 100644 --- a/publichealth/templates/header.html +++ b/publichealth/templates/header.html @@ -1,18 +1,19 @@ +{% load wagtailcore_tags navigation %} +