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',
     } );


_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to