File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -238,19 +238,27 @@ def localized(self):
238238
239239
240240class LocalizedBooleanValue (LocalizedValue ):
241- def __bool__ (self ):
242- """Gets the value in the current language as a boolean."""
243- value = self . translate ()
241+ def translate (self ):
242+ """Gets the value in the current language, or in the configured fallbck
243+ language."""
244244
245- if value is None :
246- return self .default_value
247- elif isinstance (value , bool ):
245+ value = super ().translate ()
246+ if value is None or (isinstance (value , str ) and value .strip () == "" ):
247+ return None
248+
249+ if isinstance (value , bool ):
248250 return value
249251
250252 if value .lower () == "true" :
251253 return True
252254 return False
253255
256+ def __bool__ (self ):
257+ """Gets the value in the current language as a boolean."""
258+ value = self .translate ()
259+
260+ return value
261+
254262 def __str__ (self ):
255263 """Returns string representation of value."""
256264
You can’t perform that action at this time.
0 commit comments