#30272: get_language_from_path not respecting i18n_patterns
prefix_default_language=False
-------------------------------------+-------------------------------------
Reporter: Stefan Wehrmeyer | Owner: nobody
Type: Bug | Status: closed
Component: | Version: 2.1
Internationalization |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Stefan Wehrmeyer):
Hey Carlton, thanks for reviewing.
The problem with `get_language_from_request` is that the browser `Accept-
Language` header is very likely set and will determine the language.
However, I want the language to be determined by the path – even when
`prefix_default_language=False`. This works with
`prefix_default_language=True`.
`LocaleMiddleware` actually does this, but does it around
`get_language_from_request`:
https://github.com/django/django/blob/cbf7e71558c94ce1c327b683768a18a25d82d197/django/middleware/locale.py#L19-L24
So maybe an idea could be to move these lines into
`get_language_from_request` in order to make this logic available to other
Django apps that rely on this API (in my case django cms). Not sure if
this would be a backwards-incompatible change though.
--
Ticket URL: <https://code.djangoproject.com/ticket/30272#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/065.b33b494652b4e264b4bbecb0acd9167e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.