View Single Post
Old 04-03-2021, 08:30 AM   #21
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,755
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I also noticed that when I used bistate booleans, true/false also worked the same as yes/no. I had to fix a bunch of saved searches when I switched to tristate.
That is because bistate bools are implemented using tristate. Undefined is used for the False value.
Quote:
now I am curious, how does searching for #bool:yes/no work with translations?
The rules from the code:

First the local (translated) words are determined. This is for English.
  • self.local_no = icu_lower(_('no'))
  • self.local_yes = icu_lower(_('yes'))
  • self.local_unchecked = icu_lower(_('unchecked'))
  • self.local_checked = icu_lower(_('checked'))
  • self.local_empty = icu_lower(_('empty'))
  • self.local_blank = icu_lower(_('blank'))
The comparisons are below. The quoted strings are literal, not translated.
  • Value 'True': self.local_yes, self.local_checked, 'checked', '_checked', 'yes', '_yes', 'true'
  • Value 'False':self.local_no, self.local_unchecked, 'unchecked', '_unchecked', 'no', '_no', 'true'
  • Value Undefined: self.local_empty, self.local_blank, 'blank', '_blank', 'empty', '_empty', 'false'
To head off the inevitable next question, '_yes' etc exist because it is possible the the translation of (for example) 'Empty' is 'Yes'. The words 'true' and 'false' are reserved.

Last edited by chaley; 04-03-2021 at 02:29 PM.
chaley is offline   Reply With Quote