Self hosted FLOSS fitness/workout, nutrition and weight tracker
Correctly translate the path in the language switcher
Roland Geider767d30b864b8
diff --git a/manager/context_processor.py b/manager/context_processor.pyindex 523b77978..eea6c64b8 100644--- a/manager/context_processor.py+++ b/manager/context_processor.py@@ -23,6 +23,8 @@ from workout_manager import constantsdef processor(request):+ full_path = request.get_full_path()+context = {# Application version'version': get_version(),@@ -34,7 +36,11 @@ def processor(request):'language': load_language(),# The current path- 'request_full_path': request.get_full_path()+ 'request_full_path': full_path,++ # Translation links+ 'i18n_path': {'de': '/de' + full_path[3:],+ 'en': '/en' + full_path[3:]},}# Pseudo-intelligent navigation herediff --git a/manager/templates/template.html b/manager/templates/template.htmlindex 9f71953fa..44c3b9141 100644--- a/manager/templates/template.html+++ b/manager/templates/template.html@@ -170,7 +170,7 @@{% endif %}<li {% if language.short_name == 'de' %}class="active"{% endif %}>- <a href="/de/">+ <a href="{{i18n_path.de}}"><img src="{% static 'images/icons/flag-de.svg' %}"width="18"height="18"@@ -179,7 +179,7 @@{% trans "German" %}</a></li><li {% if language.short_name == 'en' %}class="active"{% endif %}>- <a href="/en/">+ <a href="{{i18n_path.en}}"><img src="{% static 'images/icons/flag-en.svg' %}"width="18"height="18"