id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 19763 LocaleMiddleware should check for supported languages in settings.LANGUAGE_CODE too Emanuel Steen Łukasz Langa "We have a Django project with the setting: LANGUAGE_CODE = 'en-us' LANGUAGES = ( ('en', 'English'), ('sv', 'Swedish'), ) These settings should be correct according to the documentation https://docs.djangoproject.com/en/dev/ref/settings/#language-code. We also have the middleware django.middleware.locale.LocaleMiddleware enabled. However, in django.utils.translation.trans_real.py in the method get_language_from_request(...) it simply falls back to settings.LANGUAGE_CODE without any validation. I expected it to check whether the language is supported or not in the same manner as for what it done for the URL, the cookie and the HTTP header. This can easily be tested with curl (for example). {{{ $ curl -v -H ""Accept-Language: asd"" http://localhost:8000/ -o /dev/null * About to connect() to localhost port 8000 (#0) * Trying 127.0.0.1... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connected * Connected to localhost (127.0.0.1) port 8000 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.27.0 > Host: localhost:8000 > Accept: */* > Accept-Language: asd > * additional stuff not fine transfer.c:1037: 0 0 * additional stuff not fine transfer.c:1037: 0 0 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0* HTTP 1.0, assume close after body < HTTP/1.0 302 FOUND < Date: Thu, 07 Feb 2013 08:45:28 GMT < Server: WSGIServer/0.1 Python/2.7.3 < Vary: Cookie < Content-Type: text/html; charset=utf-8 < Location: http://localhost:8000/en-us/ < { [data not shown] 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 * Closing connection #0 }}} Here the client sends a totally unknown language and the server responds with redirecting to http://localhost:8000/en-us/ when I expect it to redirect to http://localhost:8000/en/ " Bug closed Internationalization 1.4 Normal fixed locale Accepted 1 0 1 0 0 0