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()