Ah, one more thing.

It doesn't matter if you disable the translator in a form element or
validator. The "isValid" method in Zend_Form will assign the translator
again to elements if there's a translator available.

On Mon, Apr 28, 2008 at 4:33 PM, Xavier Vidal Piera <[EMAIL PROTECTED]>
wrote:

> Ok, let's see.
>
> I have a form with a Text input, a Password input and a Checkbox.
>
> The "Zend_Validate_NotEmpty" validator has a message id "isEmpty".
>
> In my translations file i have a translation for the "isEmpty" key, for
> example, "Value is required".
>
> When i setup the form, i call the "Zend_Form::setDefaultTranslator(...)"
> to pass my Zend_Translate object.
>
> Ok, at the moment, every "Required" field error will throw my translated
> message.
>
> But, i need to have a different message when the checkbox is not set.
> Althought i can call "setMessage" and override the template message in the
> NotEmpty validator on the Checkbox form element, my new message will be
> override later by the Translator because is using the same key.
>
>
> On Mon, Apr 28, 2008 at 3:36 PM, Thomas Weidner <[EMAIL PROTECTED]>
> wrote:
>
> > Xavier,
> >
> > I quite dont understand your problem.
> >
> > When doing a translation with Zend_Translate all inputs are translated
> > to defined output.
> > When you don't want something to be translated then don't call
> > Zend_Translate on it.
> > Of course will Zend_Translate translate all given messageids... that's
> > the reason why we created it. :-)
> > There is no way of switching off translation for particular messageids
> > because you will eighter NOT CALL Zend_Translate on them of simply have no
> > translation for this messageids.
> >
> > It would be better when you give some examplecode so your problem is
> > reproducable.
> >
> > Greetings
> > Thomas Weidner, I18N Team Leader, Zend Framework
> > http://www.thomasweidner.com
> >
> > ----- Original Message ----- From: "Xavier Vidal Piera" <
> > [EMAIL PROTECTED]>
> > To: "Zend Framework General" <[email protected]>
> > Sent: Monday, April 28, 2008 2:04 PM
> > Subject: [fw-general] Overriding Zend_Validate messages
> >
> >
> >
> >  Hi
> > >
> > > We're using a Zend_Translate object as a default translator for our
> > > Zend_Form objects.
> > >
> > > In this Translation object we have all our common translations but,
> > > sometimes we want to override a validation error message with the
> > > method
> > > "$v->setMessage()" but looking at the source code we can see that
> > > Zend_Translate always replaces the messages althought we've override
> > > the
> > > validator default message template.
> > >
> > > Is there any way to override these message templates without disabling
> > > the
> > > Form's default translator and without extending validators?
> > >
> > > Thanks
> > >
> > > --
> > > Xavier Vidal Piera
> > > Enginyer Tècnic Informàtic de Gestió
> > > Tècnic Especialista Informàtic d'equips
> > > [EMAIL PROTECTED]
> > > [EMAIL PROTECTED]
> > > http://web.xaviervidal.net
> > > 610.68.41.78
> > >
> > >
> >
>
>
> --
> Xavier Vidal Piera
> Enginyer Tècnic Informàtic de Gestió
> Tècnic Especialista Informàtic d'equips
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> http://web.xaviervidal.net
> 610.68.41.78
>



-- 
Xavier Vidal Piera
Enginyer Tècnic Informàtic de Gestió
Tècnic Especialista Informàtic d'equips
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://web.xaviervidal.net
610.68.41.78

Reply via email to