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

2023-04-27 Thread Anthony Baillard
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 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/cdc7e87e-929a-447b-be21-de180ef9f6bbn%40googlegroups.com.


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

2023-04-27 Thread Mariusz Felisiak
Anthony, please don't start the same discussion on multiple channels.

If anyone wants to add a comment, please do so in the forum 

.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e5ac7207-08c9-49e9-8045-404c28489cb7n%40googlegroups.com.