Don't fail on macosx: "unknown locale: UTF-8"

This commit is contained in:
Manel Clos 2018-02-26 07:29:55 +01:00 committed by GitHub
commit b6b9f2af40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,11 @@ import six
from pelican import __version__
locale.setlocale(locale.LC_ALL, '')
_DEFAULT_LANGUAGE = locale.getlocale()[0]
try:
_DEFAULT_LANGUAGE = locale.getlocale()[0]
except ValueError:
# Don't fail on macosx: "unknown locale: UTF-8"
_DEFAULT_LANGUAGE = None
if _DEFAULT_LANGUAGE is None:
_DEFAULT_LANGUAGE = 'English'
else: