#29425: Auto language redirect does not work if prefix_default_language=False in
root URLConf
-------------------------------------+-------------------------------------
     Reporter:  Nathan Humphreys     |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:                       |                  Version:  1.11
  Internationalization               |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by stefanor):

 * status:  closed => new
 * resolution:  invalid =>


Comment:

 Ingo: Your example does not use `prefix_default_language=False`. The URL
 conf should have been:

 {{{
 urlpatterns += i18n_patterns(
     url(r'^about/$', about, name='about'),
     prefix_default_language=False
 )
 }}}

 I've run into this issue too. And it looks like a last-minute design
 decision in #25933. The follow-up commit
 (85a4844f8a8e628b90fa30ba7074f162a2d188ef) introduced this issue, together
 with this test, that makes it clear it was intentional:

 {{{
 def test_unprefixed_language_other_than_accept_language(self):
     response = self.client.get('/simple/', HTTP_ACCEPT_LANGUAGE='fr')
     self.assertEqual(response.content, b'Yes')
 }}}

 I'd expect the result of this request to be a redirect to `/fr/simple/`.

 Presumably `/en/simple/` would return an English result, if one needed to
 override the browser.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29425#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/069.7ef742c19914f89afbcca4653ac0b98e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to