template: print warning message and use DEFAULT_LOCALE on bad locale
This commit is contained in:
parent
ef6c0c30f5
commit
d8080c8ad2
1 changed files with 7 additions and 1 deletions
|
|
@ -219,7 +219,13 @@ class Renderer(object):
|
|||
def setLocale(self, locale_str):
|
||||
if locale_str == self._locale_str:
|
||||
return
|
||||
locale = Locale.parse(locale_str)
|
||||
try:
|
||||
locale = Locale.parse(locale_str)
|
||||
except ValueError as e:
|
||||
log.warning(_(u"invalid locale value: {msg}").format(msg=e))
|
||||
locale_str = self._locale_str = DEFAULT_LOCALE
|
||||
locale = Locale.parse(locale_str)
|
||||
|
||||
locale_str = unicode(locale)
|
||||
if locale_str != DEFAULT_LOCALE:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue