Dear django developers,
I have reported a few days ago an issue in Django 4.2 regarding translatable URL patterns: 34515
Sarah Boyce (thank you Sarah) is working on a patch to fix the 404 issue pull/16797 (sorry I can add only 2 links as a new user)
But, for now, we do not agree on the correct behavior in the case described. So, as she suggested, I write to ask the community.
In brief:
- Using
i18n_patterns
withdefault_prefix_language = True
with 3 different languages (perfectly OK):
- /en/about/ goes to English page
- /es/a-proposito/ goes to Spanish page
- /fr/a-propos/ goes to French page
- Using
i18n_patterns
withdefault_prefix_language = False
with 3 different languages and default to english (perfectly OK):
-
/about/ goes to English page (in 4.1 based on
get_language_from_path
, in 4.2 because my browser language cookie or header matches the default language) - /es/a-proposito/ goes to Spanish page
- /fr/a-propos/ goes to French page
- Using
i18n_patterns
withdefault_prefix_language = False
with 3 different languages and default to french in Django 4.1 (seems OK to me):
- /en/about/ goes to English page
- /es/a-proposito/ goes to Spanish page
- /a-propos/ goes to French page
- Using
i18n_patterns
withdefault_prefix_language = False
with 3 different languages and default to french in Django 4.2 (bug report):
- /en/about/ goes to English page
- /es/a-proposito/ goes to Spanish page
- /a-propos/ raises HTTP 404 (because cookie or http header is not ‘fr’)
- Using
i18n_patterns
withdefault_prefix_language = False
with 3 different languages and default to french with Sarah’s patch (what we do not agree on):
- /en/about/ goes to English page
- /es/a-proposito/ goes to Spanish page
- /a-propos/ redirects to /en/about/ (because cookie or http header is ‘en’)
IMO, behavior 3 is good (because it reproduces 1 without prefix). Sarah’s and Nessita’s opinion is that behavior 5 is correct.
More details in the issues and PR.
Related topic: #1234
So, what do you think? Thank you!
Anthony