|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Form Element Translations IssueHi,
I am not sure if this message should be posted in MVC or here, but anyways I am posting it on this forum. I am using ZF version 1.5.2 and I perform internationalization using the gettext adapter. I have a separate PHP file that lists all default Zend Framework form validation errors and I call upon the translate object on them and translations work fine. However, whenever I perform translations of custom error messages within my form subclass, it's always the translated default Zend Framework form errors that get displayed and not my customized error messages. I see that the fix mentioned for issue http://framework.zend.com/issues/browse/ZF-3313 is already implemented in the current ZF release but I still face this issue. All ZF default form errors are translated in a separate PHP file like this: $a = $translator->errortranslate('isEmpty'); $a = $translator->errortranslate('NotEmpty'); $a = $translator->errortranslate('regexNotMatch'); Customized error message in my form subclass looks like this: $email->addValidator('NotEmpty', true); $email->getValidator('NotEmpty')->setMessage($translator->translate('Email cannot be empty')); $email->setRequired(true); Now, when the form is submitted with email left blank, the error displayed is the translated text for 'isEmpty' and not my customized error message. However, when I comment the translation for 'isEmpty' in my default form errors file, my customized error message is displayed properly. // $a = $translator->errortranslate('isEmpty'); Please advise. Thanks! Jerry |
|
|
Re: Form Element Translations IssuePlease ask in the MVC list.
This seems to be a problem of Zend_Form as translation works like you described in other parts of your application. You could test this yourself by debugging. Try to manually translate the error-text and look if you are getting the translated message or not. If not the problem is within your translation source, if yes the problem is within the form component. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com ----- Original Message ----- From: "Jerry McG" <kumar.smg@...> To: <fw-i18n@...> Sent: Tuesday, June 17, 2008 5:06 AM Subject: [fw-i18n] Form Element Translations Issue > > Hi, > > I am not sure if this message should be posted in MVC or here, but anyways > I > am posting it on this forum. > > I am using ZF version 1.5.2 and I perform internationalization using the > gettext adapter. I have a separate PHP file that lists all default Zend > Framework form validation errors and I call upon the translate object on > them and translations work fine. However, whenever I perform translations > of > custom error messages within my form subclass, it's always the translated > default Zend Framework form errors that get displayed and not my > customized > error messages. > > I see that the fix mentioned for issue > http://framework.zend.com/issues/browse/ZF-3313 is already implemented in > the current ZF release but I still face this issue. > > All ZF default form errors are translated in a separate PHP file like > this: > $a = $translator->errortranslate('isEmpty'); > $a = $translator->errortranslate('NotEmpty'); > $a = $translator->errortranslate('regexNotMatch'); > > Customized error message in my form subclass looks like this: > $email->addValidator('NotEmpty', true); > $email->getValidator('NotEmpty')->setMessage($translator->translate('Email > cannot be empty')); > $email->setRequired(true); > > > Now, when the form is submitted with email left blank, the error displayed > is the translated text for 'isEmpty' and not my customized error message. > However, when I comment the translation for 'isEmpty' in my default form > errors file, my customized error message is displayed properly. > // $a = $translator->errortranslate('isEmpty'); > > Please advise. > > Thanks! > > Jerry > -- > View this message in context: > http://www.nabble.com/Form-Element-Translations-Issue-tp17877207p17877207.html > Sent from the Zend I18N/Locale mailing list archive at Nabble.com. |
| Free Forum Powered by Nabble | Forum Help |