1๐
I tried getting the language code instead of displaying the flag image and it worked with me
<form class="d-flex"> {% csrf_token %}
<ul class="navbar-nav mx-0 me-auto mb-2 mb-lg-0">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown2" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Language
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown" style="right: 0; left: -65px;">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<li><a class="dropdown-item" href="#">
{% if language.code == LANGUAGE_CODE %} selected{% endif %}
{{ language.name_local }} ({{ language.code }})</a></li>
{% endfor %}
</ul>
</ul>
</form>
๐คMaha Sayed
Source:stackexchange.com