I could set and use set_language() as shown below:
# "core/urls.py"
...
urlpatterns += [
path("i18n/", include("django.conf.urls.i18n")) # Here
]
Now, I want to change the default cookie name django_language
below considering the security because users can easily know that Django is used for the website:
So, how can I change the default cookie name django_language
?
By setting LANGUAGE_COOKIE_NAME in
settings.py
as shown below, you can change the default cookie namedjango_language
set by set_language():Then, you can change it to
mylang
as shown below: