Hello,

I'm newie, I've a problem (and a solution) for use localization in
variable $validate in models.

I'll ilustrate the problem with an example, I want to make something
like this:

<code>
        var $validate = array
        (
                "status" => array
                (
                        "rule" => "numeric",
                        "rule" => array ("range", -1, 101),
                        "message" => "error_task_status",
                ),
        );
</code>

If you see the message for the error on validation, you see
"error_task_status", the idea is that the model calls
__("error_task_status") for the message instead of printing
"error_task_status" directly.

I've searched into "Model" class, and I've located this section of
code (at line 2164 in "invalidFields" method):
<code>
                                if (isset($validator['message'])) {
                                        $message = $validator['message'];
                                } else {
                                        $message = __('This field cannot be 
left blank', true);
                                }
</code>

And I've changed the code to this:
<code>
                                if (isset($validator['message'])) {
                                        $validator['message'] = __ 
($validator['message'], true);
                                        $message = $validator['message'];
                                } else {
                                        $message = __('This field cannot be 
left blank', true);
                                }
</code>

With this I've found a solution to the problem!.

How can I propose this change to be included into the developmento of
CakePHP???

Thank's a lot for your effort!!!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to