FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bpython-bpython/bpython/translations/__init__.py at main · sthagen/bpython-bpython · GitHub
sthagen
/
bpython-bpython
Public
forked from
bpython/bpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Security and quality
0
Insights
Additional navigation options
Code
Security and quality
Insights
Expand file tree
Breadcrumbs
bpython-bpython
/
bpython
/
translations
/
__init__.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (30 loc) · 1.04 KB
Breadcrumbs
bpython-bpython
/
bpython
/
translations
/
__init__.py
Copy path
File metadata and controls
40 lines (30 loc) · 1.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import
gettext
import
locale
import
os
.
path
import
sys
from
typing
import
Optional
,
cast
,
List
from
..
import
package_dir
translator
:
gettext
.
NullTranslations
=
cast
(
gettext
.
NullTranslations
,
None
)
def
_
(
message
)
->
str
:
return
translator
.
gettext
(
message
)
def
ngettext
(
singular
,
plural
,
n
):
return
translator
.
ngettext
(
singular
,
plural
,
n
)
def
init
(
locale_dir
:
str
|
None
=
None
,
languages
:
list
[
str
]
|
None
=
None
)
->
None
:
try
:
locale
.
setlocale
(
locale
.
LC_ALL
,
""
)
except
locale
.
Error
:
# This means that the user's environment is broken. Let's just continue
# with the default C locale.
sys
.
stderr
.
write
(
"Error: Your locale settings are not supported by "
"the system. Using the fallback 'C' locale instead. "
"Please fix your locale settings.
\n
"
)
global
translator
if
locale_dir
is
None
:
locale_dir
=
os
.
path
.
join
(
package_dir
,
"translations"
)
translator
=
gettext
.
translation
(
"bpython"
,
locale_dir
,
languages
,
fallback
=
True
)
Back
|
FazBrowse Home
|
New Git URL