cli: Skip gettext setup if setting locale fails

Can happen if user provides a busted locale
This commit is contained in:
Cole Robinson 2012-01-29 16:03:45 -05:00
parent 680f44ec93
commit 9c23dfa992

View File

@ -85,7 +85,12 @@ def setup_logging(appname, debug_stdout):
sys.excepthook = exception_log
def setup_i18n(gettext_app, gettext_dir):
locale.setlocale(locale.LC_ALL, '')
try:
locale.setlocale(locale.LC_ALL, '')
except:
# Can happen if user passed a bogus LANG
pass
gettext.install(gettext_app, gettext_dir)
gettext.bindtextdomain(gettext_app, gettext_dir)