Opened 2 years ago
Last modified 21 months ago
#34069 closed Cleanup/optimization
get_language_from_request should not fallback to settings.LANGUAGE_CODE — at Initial Version
Reported by: | sergioisidoro | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | 4.1 |
Severity: | Normal | Keywords: | i18n get_language_from_request middleware |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'm writing a middleware to fallback to a different language depending on the TLD of the domain of the HTTP_HOST
However, I noticed that get_language_from_request
falls back to the settings default language, which will almost always take precedence in this case.
This is quite confusing, since settings.LANGUAGE_CODE
is not "from the request", but from the application configuration, and it feels that the responsibility of falling back to the default language should lie in the Middleware, not in this function.