Is there any possibility to use the gettext functionallity within the CakePHP model validation array?
Usually a programmer would do it like this:
class Data extends AppModel
{
var $validate = array(
'title' => array(
'NichtLeer' => array(
'rule' => array('between', 4, 20),
'allowEmpty' => false,
'message' => _('Bitte geben Sie einen Titel an!')
)
)
);
}
But since it is not possible to use functions outside a method’s scope, I have to find another clean alternative.
So, is there any alternative to the one, that defines the validations improvised in the model’s setup method?
Regards,
Benedikt
Building the
validatearray in the constructor could be considered a clean alternative: