Skip to content

Commit

Permalink
Make Internationalization compatible for Python 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
DivingDuck committed Jan 25, 2021
1 parent c0a1cac commit 95e6830
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions printrun/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ def set_utf8_locale():
# found (windows)
def install_locale(domain):
shared_locale_dir = os.path.join(DATADIR, 'locale')
translation = None
lang = locale.getdefaultlocale()

if os.path.exists(shared_locale_dir):
gettext.install(domain, shared_locale_dir)
translation = gettext.translation(domain, shared_locale_dir, languages=[lang[0]], fallback= True)
else:
gettext.install(domain, './locale')
translation = gettext.translation(domain, './locale', languages=[lang[0]], fallback= True)
translation.install()

class LogFormatter(logging.Formatter):
def __init__(self, format_default, format_info):
Expand Down

0 comments on commit 95e6830

Please sign in to comment.