From 9db1f2dc9bac293934ff0b45102f94bc501eb49a Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Tue, 26 Nov 2024 17:11:40 -0300 Subject: [PATCH] added custom tag and dropdown button at footer --- dashboard/templates/base.html | 25 ++++++++++++++++++++----- dashboard/templatetags/language_code.py | 11 +++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 dashboard/templatetags/language_code.py diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html index 40e6658..b79cca6 100644 --- a/dashboard/templates/base.html +++ b/dashboard/templates/base.html @@ -1,4 +1,4 @@ -{% load i18n static %} +{% load i18n static language_code %} @@ -7,7 +7,7 @@ {% block meta %} - + {% endblock %} @@ -207,10 +207,25 @@ - + diff --git a/dashboard/templatetags/language_code.py b/dashboard/templatetags/language_code.py new file mode 100644 index 0000000..a7c1e74 --- /dev/null +++ b/dashboard/templatetags/language_code.py @@ -0,0 +1,11 @@ +from django import template +from django.utils.translation import get_language_info + +register = template.Library() + +@register.filter +def get_language_code(language_code, languages): + for lang in languages: + if lang['code'] == language_code: + return lang['name_local'].lower() + return language_code.lower()