#34515: Translatable URL patterns raise 404 for non-English default language
when
prefix_default_language=False is used.
-------------------------------------+-------------------------------------
Reporter: ab | Owner: nobody
Type: Bug | Status: new
Component: | Version: 4.2
Internationalization |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
internationalization, i18n, |
prefix_default_language |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):
Replying to [comment:1 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.
IMO it still works that way. However, in Django 4.2
`get_language_from_request()` returns the language from a request (`en`
for me) which is activated and the default path `about/` is no longer
translated to the `a-propos/`. This is definitely a change from the
previous behavior.
--
Ticket URL: <https://code.djangoproject.com/ticket/34515#comment:4>
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/01070187b7aec77d-7490dd3e-2e84-4bcb-b11f-aad4e5de00bf-000000%40eu-central-1.amazonses.com.