[html-formfu] I18N localization and Catalyst
Johannes
list100 at hoerburger.org
Thu Jun 25 09:17:35 GMT 2009
Thank you very much for your answer Carl!
It helped me to at least understand it a little better :-)
two things remained unclear:
After adding my I18N's via:
---
add_localize_object: 'MyApp::I18N'
indicator: submit
elements:
...
how can I make the label of a field localized? something like:
elements:
- type: Text
name: email
label_loc: email
constraints:
- Required
- Email
didn't do the trick.
The second question:
How do I tell HTML::FormFu's yml's to what language it should localize
the constraint errormessages (e.g. which /FormFu/I18N/lang.pm to use
for that certain request)?
it doesn't guess it by itself like $c->localize() does it in catalyst
based on the browsers language defaults).
Thank you once more for your help,
Johannes
Am 23.06.2009 um 12:46 schrieb Carl Franks:
> To completely replace HTML::FormFu's own I18N files - see
> localize_class()
> http://search.cpan.org/~cfranks/HTML-FormFu-0.05000/lib/HTML/FormFu.pm#localize_class
>
> To supplement it, see the methods in HTML::FormFu::Localize -
> unfortunately they're not documented, and not very well tested.
> You'll probably want either add_localize_object() or
> add_localize_object_from_class() to set it in a config file.
>
>> for error messages on validation I'd be thankful too for hints how
>> to tell
>> my forms/formconfigs to hand out localized error messages...
>>
>> something like:
>> elements:
>> - type: Text
>> name: email
>> label: "Email:"
>> constraints:
>> - message_loc: wrongemail
>> - Required
>> - Email
>
> That's an array of 3 items - each of which should be an individual
> constraint.
> The first will fail because it doesn't define a 'type'
> Did you mean this... ?
>
> constraints:
> - Required
> - type: Email
> message_loc: wrongemail
>
> Which is equivalent to:
>
> $field->constraint( 'Required' );
>
> $field->constraint( {
> type => 'Email',
> message_loc => 'wrongemail',
> } );
More information about the HTML-FormFu
mailing list