+sub _as_bool_yn {
+ my ($package, $attribute, %params) = @_;
+
+ no strict 'refs';
+ *{ $package . '::' . $attribute . '_as_bool_yn' } = sub {
+ my ($self) = @_;
+
+ if (@_ > 1) {
+ die 'not an accessor';
+ }
+
+ return !defined $self->$attribute ? ''
+ : $self->$attribute ? $::locale->text('Yes')
+ : $::locale->text('No');
+ }
+}
+