Django behavior on translatable URL patterns (i18n_patterns) when prefix_default_language=False is used.

Hi Nathalia,

Thanks for the lively discussion :grinning:

You are spot on with this question. The short answer, IMHO, is that you can view the page in the default language navigating to /a-propos issuing a request without any lang preference.

I am sorry I cannot agree with such a statement. Who (except geeks like us) knows how to remove a cookie or change the Accept-Language header of their browser? Most people just except to see a page in french when they click on a “FR” link :point_up_2:. And that’s the choice of the website editor whether some routes (“/” for instance) are to be translated automatically or not (@sarahboyce, your idea of adding an option might be helpful here).

As @carltongibson said, what you propose do not let you reach the default language.

Regarding wikipedia, all right, it redirects you when you copy/paste the link, that happens to me too. But, then, I can click on “spanish” and I can have access to the spanish page. As @carltongibson also said (thanks pal :sweat_smile:), it works because www subdomain redirects you based on your browser but once you’re on the en subdomain or es subdomain, it ignores your 'Accept-Language' header. That is why https://es.wikipedia.org/wiki/Association_football is a 404, it does not redirect to https://en.wikipedia.org/wiki/Association_football.

So the www subdomain works almost as 5, except that it redirects you to another subdomain, and that’s a difference :slight_smile:. But then, the “language-prefixed-subdomains” do not use URL redirection at all. And if you want to change, you’re free to do so.

Once again, I am sorry to insist, when you activate i18n_patterns with default_prefix_language = False, I think 3 is the correct behavior. Because if you want use a cookie or header to detect the language, you just don’t use i18n_patterns but LocaleMiddleware alone. In that case I agree that Django should do its best to redirect the visitor.

In the end, I agree with that comment.

TTYL for sure!