def process_response(self, request, response):
        language = translation.get_language()
        if (response.status_code == 404 and
                not translation.get_language_from_path(request.path_info)
                    and self.is_language_prefix_patterns_used()):
            urlconf = getattr(request, 'urlconf', None)
            language_path = '/%s%s' % (language, request.path_info)
            path_valid = is_valid_path(language_path, urlconf)
            if (not path_valid and settings.APPEND_SLASH
                    and not language_path.endswith('/')):
                path_valid = is_valid_path("%s/" % language_path, urlconf)

            if path_valid:
                path = request.get_full_path()
                script_mount = request.META.get("SCRIPT_NAME", "")
                
                if path.startswith(script_mount):
                    path = path.replace(script_mount, ("%s/%s" % (script_mount, language)), 1)
                
                language_url = "%s://%s%s" % (
                    request.is_secure() and 'https' or 'http',
                    request.get_host(), path)
                return HttpResponseRedirect(language_url)
        translation.deactivate()

        patch_vary_headers(response, ('Accept-Language',))
        if 'Content-Language' not in response:
            response['Content-Language'] = language
        return response
dataset/ETHPy150Open splunk/splunk-webframework/server/splunkdj/middlewares.py/SplunkLocaleMiddleware.process_response/original