why changing the app language with a form is not working

I’m trying to change my language from french (the default language of my web navigator and my app) to the English language.

    LANGUAGES= [
        ('fr', 'French'),
        ('en', 'English'),
    ]

Here is my form to change the language, I found it on the documentation

    <form action="{% url 'set_language' %}" method ="post"> {% csrf_token %} 
                            <input type="hidden" name="next" value ="{{ redirect_to }}">
                            <select name="language" id="">
                                {% get_available_languages as LANGUAGES  %}
                                {% get_language_info_list for LANGUAGES as languages %}
                                {% for language in languages%}
                                    <option value="{{ langauge.code }}" {% if language.code == LANGUAGE_CODE %} selected {% endif %}> 
                                        {{language.name_local}} ({{language.code}})
                                    </option>
                                {% endfor %}  
                             </select>   
                            <input type = "submit" value="Go">
                        </form>

Here is my urls pattern

    urlpatterns = [
        path('i18n/', include('django.conf.urls.i18n')),
        path('mission/',include('mission.urls')),
        path('admin/', admin.site.urls),
        path('accounts/', include('django.contrib.auth.urls')),
        url(r'^favicon\.ico$', RedirectView.as_view(url='/static/images/favicon.ico'))
    ]

at my views.py code I add this

    def index(request):
    	from django.utils import translation
    	#user_language = 'en'
    	#translation.activate(user_language)
    	#request.session[translation.LANGUAGE_SESSION_KEY] = user_language
    	if translation.LANGUAGE_SESSION_KEY in request.session:
    		del request.session[translation.LANGUAGE_SESSION_KEY]
    
    
    	return render(request, 'mission/index.html', {})

But when I try this in my views.py code to change the language manually it works


    user_language = 'en'
    translation.activate(user_language)
    request.session[translation.LANGUAGE_SESSION_KEY] = user_language

I think the problem is on the function set_langauge It is predefined on a file named i18n.py but I’m not sure

When you’re saying that “it’s not working”, what exactly do you mean? Are you getting any kind of error message on the console or in your logs? Or is it just not setting the language to the desired value? What are you seeing / not seeing that is different from what you’re expecting to see?

When I choose the English language on the form and I submit by clicking on the button, the web page is reloaded but with the french language (the default language on my web navigator) and i was expecting getting the English language cause i have some translation and i print the current_language on the HTML. No error message are printed, I think that the current_language is not changed or something like that. but when I do it manually by changing the default language on my web navigator or by changing it on the code it works.