Merge pull request #4779 from thomashk0/fix-win-lcmessages

Handle missing LC_MESSAGES attribute on Windows
This commit is contained in:
Takeshi KOMIYA
2018-03-26 01:23:00 +09:00
committed by GitHub

View File

@@ -253,7 +253,13 @@ def init_console(locale_dir, catalog):
.. versionadded:: 1.8
"""
language, _ = locale.getlocale(locale.LC_MESSAGES) # encoding is ignored
try:
# encoding is ignored
language, _ = locale.getlocale(locale.LC_MESSAGES)
except AttributeError:
# LC_MESSAGES is not always defined. Fallback to the default language
# in case it is not.
language = None
return init([locale_dir], language, catalog, 'console')