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
31e87203
Kaydet (Commit)
31e87203
authored
Ara 23, 2010
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
kill some function imports
üst
a91dd1e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
gettext.py
Lib/gettext.py
+14
-16
No files found.
Lib/gettext.py
Dosyayı görüntüle @
31e87203
...
...
@@ -46,7 +46,7 @@ internationalized, to the local language and cultural habits.
# find this format documented anywhere.
import
locale
,
copy
,
os
,
re
,
struct
,
sys
import
locale
,
copy
,
io
,
os
,
re
,
struct
,
sys
from
errno
import
ENOENT
...
...
@@ -63,9 +63,8 @@ def c2py(plural):
Python lambda function that implements an equivalent expression.
"""
# Security check, allow only the "n" identifier
from
io
import
StringIO
import
token
,
tokenize
tokens
=
tokenize
.
generate_tokens
(
StringIO
(
plural
)
.
readline
)
tokens
=
tokenize
.
generate_tokens
(
io
.
StringIO
(
plural
)
.
readline
)
try
:
danger
=
[
x
for
x
in
tokens
if
x
[
0
]
==
token
.
NAME
and
x
[
1
]
!=
'n'
]
except
tokenize
.
TokenError
:
...
...
@@ -109,36 +108,35 @@ def c2py(plural):
def
_expand_lang
(
locale
):
from
locale
import
normalize
locale
=
normalize
(
locale
)
def
_expand_lang
(
loc
):
loc
=
locale
.
normalize
(
loc
)
COMPONENT_CODESET
=
1
<<
0
COMPONENT_TERRITORY
=
1
<<
1
COMPONENT_MODIFIER
=
1
<<
2
# split up the locale into its base components
mask
=
0
pos
=
loc
ale
.
find
(
'@'
)
pos
=
loc
.
find
(
'@'
)
if
pos
>=
0
:
modifier
=
loc
ale
[
pos
:]
loc
ale
=
locale
[:
pos
]
modifier
=
loc
[
pos
:]
loc
=
loc
[:
pos
]
mask
|=
COMPONENT_MODIFIER
else
:
modifier
=
''
pos
=
loc
ale
.
find
(
'.'
)
pos
=
loc
.
find
(
'.'
)
if
pos
>=
0
:
codeset
=
loc
ale
[
pos
:]
loc
ale
=
locale
[:
pos
]
codeset
=
loc
[
pos
:]
loc
=
loc
[:
pos
]
mask
|=
COMPONENT_CODESET
else
:
codeset
=
''
pos
=
loc
ale
.
find
(
'_'
)
pos
=
loc
.
find
(
'_'
)
if
pos
>=
0
:
territory
=
loc
ale
[
pos
:]
loc
ale
=
locale
[:
pos
]
territory
=
loc
[
pos
:]
loc
=
loc
[:
pos
]
mask
|=
COMPONENT_TERRITORY
else
:
territory
=
''
language
=
loc
ale
language
=
loc
ret
=
[]
for
i
in
range
(
mask
+
1
):
if
not
(
i
&
~
mask
):
# if all components for this combo exist ...
...
...
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