Skip to content

Commit 95e6830

Browse files
committedJan 25, 2021
Make Internationalization compatible for Python 3.x
1 parent c0a1cac commit 95e6830

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎printrun/utils.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ def set_utf8_locale():
3737
# found (windows)
3838
def install_locale(domain):
3939
shared_locale_dir = os.path.join(DATADIR, 'locale')
40+
translation = None
41+
lang = locale.getdefaultlocale()
42+
4043
if os.path.exists(shared_locale_dir):
41-
gettext.install(domain, shared_locale_dir)
44+
translation = gettext.translation(domain, shared_locale_dir, languages=[lang[0]], fallback= True)
4245
else:
43-
gettext.install(domain, './locale')
46+
translation = gettext.translation(domain, './locale', languages=[lang[0]], fallback= True)
47+
translation.install()
4448

4549
class LogFormatter(logging.Formatter):
4650
def __init__(self, format_default, format_info):

0 commit comments

Comments
 (0)
Please sign in to comment.