From e40612e0a28d97294e558f1a585d8af4575e69fa Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Sep 2014 12:21:26 +0530 Subject: [PATCH] Fix #1371226 [Show Checkmarks in derivated custom columns does not properly work in Spanish (at least)](https://bugs.launchpad.net/calibre/+bug/1371226) --- src/calibre/library/caches.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 33c2f82707..43de66bcb8 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -126,15 +126,20 @@ def set_use_primary_find_in_search(toWhat): global pref_use_primary_find_in_search 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): if isinstance(val, (str, unicode)): try: val = icu_lower(val) if not val: val = None - elif val in [_('yes'), _('checked'), 'true']: + elif val in yes_vals: val = True - elif val in [_('no'), _('unchecked'), 'false']: + elif val in no_vals: val = False else: val = bool(int(val))