Description

In get_language_from_request() in the translation module (trans_real.py), when you have multiple requests to it, and in requests you for some reason change the LANGUAGES setting... get_language_from_request() breaks the supported languages, because it assumes settings.LANGUAGES will never change, and it stores in _accepted the accepted .mo files (which's found they exist in the path), but in the next request, if the LANGUAGES changed, and the .mo file exists, it no longer checks for it to be supported in the new settings.LANGUAGES...

I know you shouldn't be changing settings such as LANGUAGES between requests, django doesn't even fully support it (thread safe, that's why I added the patch in ticket #12737)...but anyway, the thing is that if django is assumed not to ever change anything in the settings, many other things could probably be further optimized, but they're not, but it all generally works just fine (using the thread safe settings I mentioned), except for this time. I'm attaching a patch that would allow it to cache the _accepted found .mo files, but still check every time the _accepted language is really currently supported.