Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
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
cpython
Commits
a91dd1e4
Kaydet (Commit)
a91dd1e4
authored
Ara 23, 2010
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use native tenary condition
üst
5793e6f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
16 deletions
+2
-16
gettext.py
Lib/gettext.py
+2
-16
No files found.
Lib/gettext.py
Dosyayı görüntüle @
a91dd1e4
...
@@ -58,20 +58,6 @@ __all__ = ['NullTranslations', 'GNUTranslations', 'Catalog',
...
@@ -58,20 +58,6 @@ __all__ = ['NullTranslations', 'GNUTranslations', 'Catalog',
_default_localedir
=
os
.
path
.
join
(
sys
.
prefix
,
'share'
,
'locale'
)
_default_localedir
=
os
.
path
.
join
(
sys
.
prefix
,
'share'
,
'locale'
)
def
test
(
condition
,
true
,
false
):
"""
Implements the C expression:
condition ? true : false
Required to correctly interpret plural forms.
"""
if
condition
:
return
true
else
:
return
false
def
c2py
(
plural
):
def
c2py
(
plural
):
"""Gets a C expression as used in PO files for plural forms and returns a
"""Gets a C expression as used in PO files for plural forms and returns a
Python lambda function that implements an equivalent expression.
Python lambda function that implements an equivalent expression.
...
@@ -99,8 +85,8 @@ def c2py(plural):
...
@@ -99,8 +85,8 @@ def c2py(plural):
# "a?b:c" to "test(a,b,c)".
# "a?b:c" to "test(a,b,c)".
expr
=
re
.
compile
(
r'(.*?)\?(.*?):(.*)'
)
expr
=
re
.
compile
(
r'(.*?)\?(.*?):(.*)'
)
def
repl
(
x
):
def
repl
(
x
):
return
"
test(
%
s,
%
s,
%
s)"
%
(
x
.
group
(
1
),
x
.
group
(
2
),
return
"
(
%
s if
%
s else
%
s)"
%
(
x
.
group
(
2
),
x
.
group
(
1
),
expr
.
sub
(
repl
,
x
.
group
(
3
)))
expr
.
sub
(
repl
,
x
.
group
(
3
)))
# Code to transform the plural expression, taking care of parentheses
# Code to transform the plural expression, taking care of parentheses
stack
=
[
''
]
stack
=
[
''
]
...
...
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