I have reported a few days ago an issue in Django 4.2 regarding
translatable URL patterns:
https://code.djangoproject.com/ticket/34515
Sarah Boyce (thank you Sarah) is working on a patch to fix the 404
issue:
https://github.com/django/django/pull/16797
But, for now, we do not agree on the correct behavior in the case
described. So, as she suggested
(
https://github.com/django/django/pull/16797#issuecomment-1524958085), I
write to ask the community.
In brief:
1. Using i18n_patterns with default_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
2. Using i18n_patterns with default_prefix_language = False with 3
different languages and default to english (perfectly OK):
- about/ goes to English page
-
/es/a-proposito/ goes to Spanish page
-
/fr/a-propos/ goes to French page
3. Using i18n_patterns with default_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
4. Using i18n_patterns with default_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')
5. Using i18n_patterns with default_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.
So, what do you think? Thank you!
Anthony