#34515: prefix_default_language=False raises HTTP 404 for default language if
LANGUAGE_CODE != 'en'
-------------------------------------+-------------------------------------
     Reporter:  ab                   |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Other)         |                  Version:  4.2
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
  internationalization, i18n,        |  Unreviewed
  prefix_default_language            |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by ab):

 Expected behavior:
 [https://docs.djangoproject.com/en/4.2/topics/i18n/translation/#how-
 django-discovers-language-preference django 4.2 documentation]

 LocaleMiddleware tries to determine the user’s language preference by
 following this algorithm:

 - First, it looks for the language prefix in the requested URL. This is
 only performed when you are using the i18n_patterns function in your root
 URLconf. See Internationalization: in URL patterns for more information
 about the language prefix and how to internationalize URL patterns.

 - Failing that, it looks for a cookie. The name of the cookie used is set
 by the LANGUAGE_COOKIE_NAME setting. (The default name is
 django_language.)

 - Failing that, it looks at the Accept-Language HTTP header. This header
 is sent by your browser and tells the server which language(s) you prefer,
 in order by priority. Django tries each language in the header until it
 finds one with available translations.

 - Failing that, it uses the global LANGUAGE_CODE setting.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34515#comment:1>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070187b793b0d2-752838e1-b791-4b2f-b232-4c3f0dd674bd-000000%40eu-central-1.amazonses.com.

Reply via email to