#29425: Auto language redirect does not work if prefix_default_language=False in
root URLConf
-------------------------------------+-------------------------------------
     Reporter:  Nathan Humphreys     |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:                       |                  Version:  1.11
  Internationalization               |
     Severity:  Normal               |               Resolution:  invalid
     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 Ingo Klöcker):

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


Comment:

 I think there is a misunderstanding about what {{{i18n_patterns()}}} does.

 I have added the following to my root URL conf
 {{{
 urlpatterns += i18n_patterns(
     url(r'^about/$', about, name='about')
 )
 }}}
 and set {{{LANGUAGE_CODE}}} to {{{'en'}}} in {{{settings.py}}}.

 When I try
 {{{
 curl -vs http://127.0.0.1:8000/en/about/ >/dev/null
 }}}
 then I get
 {{{
 [...]
 < HTTP/1.0 200 OK
 [...]
 }}}

 But, when I try
 {{{
 curl -vs http://127.0.0.1:8000/about/ >/dev/null
 }}}
 then I get
 {{{
 [...]
 < HTTP/1.0 404 Not Found
 [...]
 }}}
 As you can see, no redirect happens.

 If I understand your report correctly, then you seem to have expected that
 the URL missing the language prefix (i.e.
 {{{http://127.0.0.1:8000/about/}}}) would have been auto-redirected to the
 prefixed URL (i.e. {{{http://127.0.0.1:8000/en/about/}}}). But that's not
 what {{{i18n_patterns()}}} does.

 All that {{{i18n_patterns()}}} does, is that it makes sure that URLs
 prefixed with the language prefix matching the user's Accept-Language
 header open the corresponding view. I have checked the code (there's
 nothing there that redirects) and the documentation (only one section,
 "The set_language redirect view", mentions redirects).

 If I have misunderstood your problem, then please reopen this report
 explaining your problem in more detail, e.g. by providing a small example
 project demonstrating the problem. Also provide some URLs demonstrating
 your expectations and what actually happens.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29425#comment:2>
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.1ee384beaf71bc90041873a7cccc71e5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to