Fix #1371226 [Show Checkmarks in derivated custom columns does not properly work in Spanish (at least)](https://bugs.launchpad.net/calibre/+bug/1371226)

This commit is contained in:
Kovid Goyal 2014-09-19 12:21:26 +05:30
parent f13f6b3b7e
commit e40612e0a2

View File

@ -126,15 +126,20 @@ def set_use_primary_find_in_search(toWhat):
global pref_use_primary_find_in_search global pref_use_primary_find_in_search
pref_use_primary_find_in_search = toWhat pref_use_primary_find_in_search = toWhat
y, c, n, u = map(icu_lower, (_('yes'), _('checked'), _('no'), _('unchecked')))
yes_vals = {y, c, 'true'}
no_vals = {n, u, 'false'}
del y, c, n, u
def force_to_bool(val): def force_to_bool(val):
if isinstance(val, (str, unicode)): if isinstance(val, (str, unicode)):
try: try:
val = icu_lower(val) val = icu_lower(val)
if not val: if not val:
val = None val = None
elif val in [_('yes'), _('checked'), 'true']: elif val in yes_vals:
val = True val = True
elif val in [_('no'), _('unchecked'), 'false']: elif val in no_vals:
val = False val = False
else: else:
val = bool(int(val)) val = bool(int(val))