Add untranslated words to custom column default specification

This commit is contained in:
Charles Haley 2020-07-04 17:00:24 +01:00
parent b106805700
commit 248edbe8fb
2 changed files with 10 additions and 8 deletions

View File

@ -102,8 +102,9 @@ def _add_default_custom_column_values(mi, fm):
mi.set_user_metadata(cc, col)
dt = col['datatype']
if dt == 'bool':
dv = {_('yes'): 'true', _('no'): 'false'}.get(icu_lower(dv), '')
elif dt == 'datetime' and icu_lower(dv) == _('now'):
dv = {_('yes'): 'true', 'yes': 'true',
_('no'): 'false', 'no': 'false'}.get(icu_lower(dv), '')
elif dt == 'datetime' and (icu_lower(dv) in [_('now'), 'now']):
dv = nowf()
elif dt == 'rating':
try:
@ -112,7 +113,7 @@ def _add_default_custom_column_values(mi, fm):
dv = None
mi.set(cc, dv)
except:
pass
traceback.print_exc()
dynamic_category_preferences = frozenset({'grouped_search_make_user_categories', 'grouped_search_terms', 'user_categories'})

View File

@ -396,11 +396,12 @@ class CreateCustomColumn(QDialog):
# Default value
self.default_value = dv = QLineEdit(self)
dv.setToolTip('<p>' + _('Default value when a new book is added to the '
'library. For Date columns enter the word "now" or the date as '
'yyyy-mm-dd. For Yes/No columns enter "Yes" or "No". For Text with '
'a fixed set of values enter one of the permitted values. For '
'Rating columns enter a number between 0 and 5.') + '</p>')
dv.setToolTip('<p>' + (_('Default value when a new book is added to the '
'library. For Date columns enter the word "Now" or "%s", or the '
'date as yyyy-mm-dd. For Yes/No columns enter "Yes" or "%s", or '
'"No" or "%s". For Text with a fixed set of values enter one of '
'the permitted values. For Rating columns enter a number between '
'0 and 5.') % ('now', 'yes', 'no')) + '</p>')
self.default_value_label = add_row(_('Default value'), dv)
self.resize(self.sizeHint())