mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Handle missing LC_MESSAGES attribute on Windows
This small fix handles the case where LC_MESSAGES is not defined in Python's locale module (e.g., on Windows).
This commit is contained in:
parent
69383f83bd
commit
2d9e7f9baa
@ -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')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user