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
c8d2120b
Kaydet (Commit)
c8d2120b
authored
Haz 07, 2016
tarafından
Thejaswi Puthraya
Kaydeden (comit)
Tim Graham
Haz 08, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26705 -- Fixed plural versions of languages not supported by Django.
üst
c4980e28
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
trans_real.py
django/utils/translation/trans_real.py
+3
-0
tests.py
tests/i18n/tests.py
+13
-0
No files found.
django/utils/translation/trans_real.py
Dosyayı görüntüle @
c8d2120b
...
@@ -113,6 +113,9 @@ class DjangoTranslation(gettext_module.GNUTranslations):
...
@@ -113,6 +113,9 @@ class DjangoTranslation(gettext_module.GNUTranslations):
self
.
__to_language
=
to_language
(
language
)
self
.
__to_language
=
to_language
(
language
)
self
.
__locale
=
to_locale
(
language
)
self
.
__locale
=
to_locale
(
language
)
self
.
_catalog
=
None
self
.
_catalog
=
None
# If a language doesn't have a catalog, use the Germanic default for
# pluralization: anything except one is pluralized.
self
.
plural
=
lambda
n
:
int
(
n
!=
1
)
if
self
.
domain
==
'django'
:
if
self
.
domain
==
'django'
:
if
localedirs
is
not
None
:
if
localedirs
is
not
None
:
...
...
tests/i18n/tests.py
Dosyayı görüntüle @
c8d2120b
...
@@ -1925,3 +1925,16 @@ class NonDjangoLanguageTests(SimpleTestCase):
...
@@ -1925,3 +1925,16 @@ class NonDjangoLanguageTests(SimpleTestCase):
def
test_non_django_language
(
self
):
def
test_non_django_language
(
self
):
self
.
assertEqual
(
get_language
(),
'xxx'
)
self
.
assertEqual
(
get_language
(),
'xxx'
)
self
.
assertEqual
(
ugettext
(
"year"
),
"reay"
)
self
.
assertEqual
(
ugettext
(
"year"
),
"reay"
)
@override_settings
(
USE_I18N
=
True
,
LANGUAGES
=
[
(
'en-us'
,
'English'
),
# xyz language has no locale files
(
'xyz'
,
'XYZ'
),
],
)
@translation.override
(
'xyz'
)
def
test_plural_non_django_language
(
self
):
self
.
assertEqual
(
get_language
(),
'xyz'
)
self
.
assertEqual
(
ungettext
(
'year'
,
'years'
,
2
),
'years'
)
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