diff --git a/publichealth/home/templatetags/navigation.py b/publichealth/home/templatetags/navigation.py index c390457..2201486 100644 --- a/publichealth/home/templatetags/navigation.py +++ b/publichealth/home/templatetags/navigation.py @@ -4,6 +4,10 @@ from django.utils import translation register = template.Library() +@register.simple_tag() +def language_cur(): + return translation.get_language() + # Language switcher @register.inclusion_tag('tags/language.html', takes_context=True) def language_switcher(context): @@ -22,6 +26,7 @@ def language_switcher(context): { 'code': 'de', 'title': 'De', 'url': url.replace('$lang$','de') }, { 'code': 'fr', 'title': 'Fr', 'url': url.replace('$lang$','fr') } ] + # TODO: make language list configurable if context['page'].get_site().root_page.slug == "sphc": language_array.append({ 'code': 'en', 'title': 'En', 'url': url.replace('$lang$','en') }) return { diff --git a/publichealth/templates/base.html b/publichealth/templates/base.html index e776d33..349d8e2 100644 --- a/publichealth/templates/base.html +++ b/publichealth/templates/base.html @@ -1,7 +1,7 @@ {% load compress static wagtailuserbar navigation information %} {% get_site_root as site_root %} - +