-- Łukasz Kazimierz Bandzarewicz <[EMAIL PROTECTED]> wrote
(on Tuesday, 29 January 2008, 07:48 PM +0100):
> On 29/01/2008, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
> Currently, you *can* pull your validator object and set the messages:
>
> $notEmpty = $element->getValidator('NotEmpty');
> $notEmpty->setMessages($messages);
>
> I've figured it out a couple minutes ago.
> It works but it is slightly inconvenient.
I agree.
> Additionally, if you are using Zend_Translate and pass a
> Zend_Translate_Adapter into your form or element, the Errors decorator
> will use the error codes as message keys for translation.
>
> Where I can find examples of this method?
On the lists -- there have been several posts about it in the last
couple weeks. Look at the archives for the fw-mvc list on nabble.com.
Basically, you simply create your translations, making sure you have
messageids that correspond to the various validation messages you'll be
using. Then, make sure you add your translation adapter to the form
object:
$form->setTranslator($translator);
At that point, things are set in motion. Currently, the following items
are automatically translated if a translation adapter is registered:
* element labels
* element validation error messages
The things I'm still working on:
* should fieldset legends be translated?
* should display values for multi-option elements be translated (i.e.,
the values displayed in select dropdowns, radios, checkboxes, etc.
-- but not the actual element value)?
* should display values for submit and button elements be translated?
> Maybe it will be good idea if you put this in Zend_Form
> documentation/examples?
I will be writing docs on Zend_Form and I18n. There are a few things
that need to be finalized for it first, however -- as you can see above.
> Don't forget about non English sites and programmers ;)
I haven't. :-) One of the initial goals for Zend_Form was that it be
easily localized, and we're getting pretty close already.
> This won't work currently, but I've marked it in my TODO as an an
> improvement. It will work by passing a 'messages' key to the validator
> options, with a value of an associative array of code/message pairs.
>
>
> Will it be available in official ZF 1.5 release?
Yes. I'll be creating an issue for it shortly, and will schedule it for
the GA release.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/