remove unicode decode error
This commit is contained in:
@ -19,6 +19,10 @@ from .i18n import _
|
||||
|
||||
|
||||
def display_list(lst, separator='and'):
|
||||
if separator == 'and':
|
||||
separator = _('and')
|
||||
elif separator == 'or':
|
||||
separator = _('or')
|
||||
if len(lst) == 0:
|
||||
return ''
|
||||
elif len(lst) == 1:
|
||||
|
@ -45,8 +45,7 @@ mo_location = LOCALE_DIR
|
||||
gettext.find(APP_NAME, mo_location)
|
||||
gettext.textdomain(APP_NAME)
|
||||
gettext.bind_textdomain_codeset(APP_NAME, "UTF-8")
|
||||
gettext.translation(APP_NAME, fallback=True)
|
||||
|
||||
t = gettext.translation(APP_NAME, fallback=True)
|
||||
|
||||
_ = t.ugettext
|
||||
_ = t.gettext
|
||||
|
@ -585,7 +585,7 @@ class Option(OnlyOption):
|
||||
'submulti_index: {2}'.format(_value, _index,
|
||||
submulti_index),
|
||||
exc_info=True)
|
||||
err_msg = unicode('{0}')
|
||||
err_msg = '{0}'.format(err)
|
||||
if err_msg:
|
||||
msg = _('"{0}" is an invalid {1} for "{2}", {3}'
|
||||
'').format(_value, self._display_name,
|
||||
|
@ -511,13 +511,16 @@ class Settings(object):
|
||||
props, self, datas, opt_type)
|
||||
else:
|
||||
if len(props) == 1:
|
||||
prop_msg = 'property'
|
||||
prop_msg = _('property')
|
||||
else:
|
||||
prop_msg = 'properties'
|
||||
prop_msg = _('properties')
|
||||
name = opt_or_descr.impl_get_display_name()
|
||||
if isinstance(name, unicode):
|
||||
name = name.encode('utf8')
|
||||
return PropertiesOptionError(_('cannot access to {0} "{1}" '
|
||||
'because has {2} {3}'
|
||||
'').format(opt_type,
|
||||
opt_or_descr.impl_get_display_name(),
|
||||
name,
|
||||
prop_msg,
|
||||
display_list(props)), props,
|
||||
self, datas, opt_type)
|
||||
|
Reference in New Issue
Block a user