F
F
fantom_ask2020-09-10 13:28:49
Django
fantom_ask, 2020-09-10 13:28:49

How to make a list of working links by changing the language?

I want to change the language of my site using links

{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGE %}
{% get_language_info_list for LANGUAGE as languages %}
{% for language in languages %}
<a href="{{language.code}}{% url   'current_saite'  %}">{{language.code}}</a>
{% endfor %}

But the problem is that I want to place this code in the base template, it should show the current link on which the user is located but with a different language,
and I don’t want to prescribe in each function inside views.py.
How can I do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question