I am using i18n_patterns to change the language prefix in url. It s working fine ones the language cookie is set. The problem is that it’s adding /en/ when I trying to access a page without the language code in private window, even though my preferred language is not en (the default one set in settings.LANGUAGE_CODE).
Django documentation says it will use the following to choose the language:
First, it looks for the language prefix in the requested URL.Failing that, it looks for the LANGUAGE_SESSION_KEY key in the current user’s session.Failing that, it looks for a cookie. The name of the cookie used is set by the LANGUAGE_COOKIE_NAME setting. (The default name is django_language.) Failing that, it looks at the Accept-Language HTTP header. This header is sent by your browser and tells the server which language(s) you prefer, in order by priority. Django tries each language in the header until it finds one with available translations. Failing that, it uses the global LANGUAGE_CODE setting.
So the reason why I get /en/ prefix in my url, when there is no any cookie set is because of the Accept-Language HTTP header. How can i solve that if somebody visits my site for the first time when there is no cookie, the i18n to go to the final step to get the language from the global LANGUAGE_CODE?