Re: Localization for Model validation messages

2009-12-27 Thread euromark
i wouldnt copy it exactly 1:1 translations should never be just "Minimum length of 8 characters" then you'd need the same text for all other 999 different character lenghts better to use sprintf(__(text, true), var1, var2, ..) with %s etc On 27 Dez., 10:47, Walther wrote: > Check here:http

Re: Localization for Model validation messages

2009-12-27 Thread Walther
Check here: http://book.cakephp.org/view/133/Multiple-Rules-per-Field (at the bottom) for the recommended method of doing it. On Dec 26, 10:55 am, si-mon wrote: > Thanks John. Thanks Euromark. Really helpful... > > On Dec 25, 9:55 pm, John Andersen wrote: > > > I can't agree, as I prefer to have

Re: Localization for Model validation messages

2009-12-26 Thread si-mon
Thanks John. Thanks Euromark. Really helpful... On Dec 25, 9:55 pm, John Andersen wrote: > I can't agree, as I prefer to have the model be concerned with model > things (data, retrieval, saving, validation, etc.), and the view > concerned with presenting the data and the related error messages, >

Re: Localization for Model validation messages

2009-12-25 Thread John Andersen
I can't agree, as I prefer to have the model be concerned with model things (data, retrieval, saving, validation, etc.), and the view concerned with presenting the data and the related error messages, including the localization! Usually I only have one form in which data for a specific model is en

Re: Localization for Model validation messages

2009-12-25 Thread euromark
i dont like the form-way it is quite redundant - if you add a new rule you might forget one or two views which would not be helpful having it all together in the model is in my opinion a cleaner approach :) On 25 Dez., 12:32, John Andersen wrote: > Use the form helpers option for the input fiel

Re: Localization for Model validation messages

2009-12-25 Thread John Andersen
Use the form helpers option for the input fields! Look at: http://book.cakephp.org/view/198/options-error Thus you localize in the view - example: echo $form->input( 'email', array( 'label' => __('e-mail address',true), 'error' => array('users_email_rule' => __ ('users_email_rul

Re: Localization for Model validation messages

2009-12-24 Thread euromark
put this in your app_model.php /** * Overrides the Core invalidate function from the Model class * with the addition to use internationalization (I18n and L10n) * @param string $field Name of the table column * @param mixed $value The message or value w

Localization for Model validation messages

2009-12-24 Thread si-mon
Hi All, Is there a way to use localization for validation messages in the Model $validate array? eg: $validate = array ( 'name' => array('rule'=>'notEmpty', 'message'=>'Name is mandatory' )); I need the message 'Name is mandatory' in five different languages. In other words: How can we use func