Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
aa089b10
Kaydet (Commit)
aa089b10
authored
Şub 28, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #5241 -- Kept active transalation in LocaleMiddleware.process_response.
üst
06de130d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
locale.py
django/middleware/locale.py
+1
-1
tests.py
tests/i18n/tests.py
+23
-0
urls.py
tests/i18n/urls.py
+9
-0
No files found.
django/middleware/locale.py
Dosyayı görüntüle @
aa089b10
...
...
@@ -51,7 +51,7 @@ class LocaleMiddleware(object):
request
.
is_secure
()
and
'https'
or
'http'
,
request
.
get_host
(),
language
,
request
.
get_full_path
())
return
HttpResponseRedirect
(
language_url
)
translation
.
deactivate
()
if
not
(
self
.
is_language_prefix_patterns_used
()
and
language_from_path
):
patch_vary_headers
(
response
,
(
'Accept-Language'
,))
...
...
tests/i18n/tests.py
Dosyayı görüntüle @
aa089b10
...
...
@@ -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"
)
tests/i18n/urls.py
0 → 100644
Dosyayı görüntüle @
aa089b10
from
__future__
import
unicode_literals
from
django.conf.urls.i18n
import
i18n_patterns
from
django.http
import
StreamingHttpResponse
from
django.utils.translation
import
ugettext_lazy
as
_
urlpatterns
=
i18n_patterns
(
''
,
(
r'^streaming/$'
,
lambda
r
:
StreamingHttpResponse
([
_
(
"Yes"
),
"/"
,
_
(
"No"
)])),
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment