feat(templates/header.html): add language switchen in header

This commit is contained in:
2026-03-11 12:37:39 +01:00
parent 2fd6ee5a73
commit a692fde6fd

View File

@@ -9,6 +9,18 @@
<a href="{% url 'account_login' %}" class="hover:underline">{% trans "Login" %}</a>
<a href="{% url 'account_signup' %}" class="hover:underline">{% trans "Sign Up" %}</a>
{% endif %}
<div class="inline-block relative group">
<form action="{% url 'set_language' %}" method="post">
{% csrf_token %}
<button type="button" class="hover:underline focus:outline-none">{% get_current_language as LANGUAGE_CODE %}{{ LANGUAGE_CODE|upper }}</button>
<div class="absolute right-0 w-32 bg-white text-black rounded-md shadow-lg hidden group-hover:block">
{% get_available_languages as LANGUAGES %}
{% for lang_code, lang_name in LANGUAGES %}
<button name="language" value="{{ lang_code }}" class="block w-full text-left rounded-md px-4 py-2 hover:bg-gray-200">{{ lang_name }}</button>
{% endfor %}
</div>
</form>
</div>
</nav>
</div>
</header>