I did makemessages, translated my strings that are {% translate 'my_string' %} in templates, and then compilemessages.
But set_language does not seem to be working.
My only translated language is es, en in the other hand is the native language of my project.
navbar.html:
<form action="{% url 'set_language' %}" method="POST" enctype="application/x-www-form-urlencoded">
{% csrf_token %}
<input id="id_language" name="language" value="es" type="hidden">
<button type="submit" class="btn btn-outline-info mx-1"><i class="fas fa-language"></i></button>
</form>
urls.py:
urlpatterns = [
path('i18n/', include('django.conf.urls.i18n')),
# ...
]
That's what I have. Then I put a pdb.set_trace() in one of my middlewares in order to check if the request is working as expected, and it does, when on debugger I type request.POST it has both the csrf_token and a language field with 'es' value.
After response, the language is still set to en instead of es. What could be happening? Am I missing something? Thanks!