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
85e7a5e1
Kaydet (Commit)
85e7a5e1
authored
Agu 18, 2012
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[py3] Stopped attempting to translate bytes.
That goes actively against the goal of cleaning string handling.
üst
2284419a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
__init__.py
django/utils/translation/__init__.py
+3
-3
trans_real.py
django/utils/translation/trans_real.py
+9
-2
tests.py
tests/regressiontests/i18n/tests.py
+1
-1
No files found.
django/utils/translation/__init__.py
Dosyayı görüntüle @
85e7a5e1
...
...
@@ -79,10 +79,10 @@ def pgettext(context, message):
def
npgettext
(
context
,
singular
,
plural
,
number
):
return
_trans
.
npgettext
(
context
,
singular
,
plural
,
number
)
ngettext_lazy
=
lazy
(
ngettext
,
bytes
)
gettext_lazy
=
lazy
(
gettext
,
bytes
)
ungettext_lazy
=
lazy
(
ungettext
,
six
.
text_type
)
gettext_lazy
=
lazy
(
gettext
,
str
)
ngettext_lazy
=
lazy
(
ngettext
,
str
)
ugettext_lazy
=
lazy
(
ugettext
,
six
.
text_type
)
ungettext_lazy
=
lazy
(
ungettext
,
six
.
text_type
)
pgettext_lazy
=
lazy
(
pgettext
,
six
.
text_type
)
npgettext_lazy
=
lazy
(
npgettext
,
six
.
text_type
)
...
...
django/utils/translation/trans_real.py
Dosyayı görüntüle @
85e7a5e1
...
...
@@ -259,6 +259,11 @@ def do_translate(message, translation_function):
return
result
def
gettext
(
message
):
"""
Returns a string of the translation of the message.
Returns a string on Python 3 and an UTF-8-encoded bytestring on Python 2.
"""
return
do_translate
(
message
,
'gettext'
)
if
six
.
PY3
:
...
...
@@ -296,8 +301,10 @@ def do_ntranslate(singular, plural, number, translation_function):
def
ngettext
(
singular
,
plural
,
number
):
"""
Returns a UTF-8 bytestring of the translation of either the singular or
plural, based on the number.
Returns a string of the translation of either the singular or plural,
based on the number.
Returns a string on Python 3 and an UTF-8-encoded bytestring on Python 2.
"""
return
do_ntranslate
(
singular
,
plural
,
number
,
'ngettext'
)
...
...
tests/regressiontests/i18n/tests.py
Dosyayı görüntüle @
85e7a5e1
...
...
@@ -232,7 +232,7 @@ class TranslationTests(TestCase):
"""
Translating a string requiring no auto-escaping shouldn't change the "safe" status.
"""
s
=
mark_safe
(
b
'Password'
)
s
=
mark_safe
(
str
(
'Password'
)
)
self
.
assertEqual
(
SafeString
,
type
(
s
))
with
translation
.
override
(
'de'
,
deactivate
=
True
):
self
.
assertEqual
(
SafeUnicode
,
type
(
ugettext
(
s
)))
...
...
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