mirror of
https://github.com/django/django.git
synced 2025-10-30 17:16:10 +00:00
Fixed #5241 -- Kept active transalation in LocaleMiddleware.process_response.
This commit is contained in:
@@ -1096,3 +1096,26 @@ class MultipleLocaleActivationTests(TestCase):
|
||||
t = Template("{% load i18n %}{% blocktrans %}No{% endblocktrans %}")
|
||||
with translation.override('nl'):
|
||||
self.assertEqual(t.render(Context({})), 'Nee')
|
||||
|
||||
|
||||
@override_settings(
|
||||
USE_I18N=True,
|
||||
LANGUAGES=(
|
||||
('en', 'English'),
|
||||
('fr', 'French'),
|
||||
),
|
||||
MIDDLEWARE_CLASSES=(
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
),
|
||||
)
|
||||
class LocaleMiddlewareTests(TestCase):
|
||||
|
||||
urls = 'i18n.urls'
|
||||
|
||||
def test_streaming_response(self):
|
||||
# Regression test for #5241
|
||||
response = self.client.get('/fr/streaming/')
|
||||
self.assertContains(response, "Oui/Non")
|
||||
response = self.client.get('/en/streaming/')
|
||||
self.assertContains(response, "Yes/No")
|
||||
|
||||
Reference in New Issue
Block a user