[Solar-talk] Localize Forms / Filters

Antti Holvikari anttih at gmail.com
Wed Jan 2 08:43:00 CST 2008


On Jan 2, 2008 2:16 PM, Tobias Nix <tobias.nix at paupau.org> wrote:
> Hello list,
>
> i try to localize my forms. the setup looks like this:
>
> $form = Solar::factory('Solar_Form');
> $form->setElement('postcode' => array(
>         'type' => 'text',
>         'label' => $this->locale('LABEL_POSTCODE'),
>         'value' => Solar::config('Vendor_App_Example', 'postcode', 50500),
>         'attribs' => array('maxlength' => 5, 'size' => 5),
>         'required' => true,
>         'filters' => array(
>                 'sanitizeTrim',
>                 array('validateRangeLength', 5,5),
>                 'validateNumeric',
>         ),
>         'descr' => $this->locale('DESCR_POSTCODE'),
> ));
>
> How can i localize form and filter feedback like INVALID_NUMERIC,
> FAILURE_FORM, SUCCESS_FORM, ...?
>
> Tried to set INVALID_NUMERIC in /vendor/App/Example/locale/de_DE.php
> without success
>
> Is it possible to define this in $form->setElement() somehow?

To me that should do it, except it's "Locale", not "locale". Try
putting the de_DE.php file in vendor/App/Example/Locale/de_DE.php.
That is, if your controller class is called vendor_App_Example.


-- 
Antti Holvikari


More information about the Solar-talk mailing list