Carl Franks schrieb:
On 24/02/07, Mario Minati <[EMAIL PROTECTED]> wrote:
Carl Franks schrieb:
> I18N support has been added, with all error messages being moved out
> to the FormFu/I18N/en.pm package.
I discovered that and found a bug (probably).
When defining a constraint like this:
$form->constraint( Required => qw/shortname name/ )->message('mm -
Required. ');
It tries to get a translation for 'mm - Required. ', which of course is
not available.
So I think we need a way to bypass the I18N.

Previously, the field 'label', 'comment' and 'value' accessors had
*_xml() varients, for ensuring that the output isn't html-escaped.
Last week as an experimental feature, I also added a *_loc() varient,
as the means for passing a string which should be localised.

I've now extended this to the constraints and errors, so they have
message(), message_xml() and message_loc()

I've described it as experimental, because I'm not sure yet if this is
the best solution, so of course it may change.
Yes I saw that, but I have still a problem understanding the code:
mk_output_accessors in HTML::FormFu::Accessor:
       my $sub = sub {
           my $self = shift;
           if (@_) {
               $self->{$name} =
                   ( @_ == 1 )
                   ? output_value( $_[0] )
                   : [ map { output_value( $_[0] ) } @_ ];
               return $self;
           }
           return $self->{$name};
       };

In my opinion it should be
map { output_value( $_ ) } @_
instead of
map { output_value( $_[0] ) } @_

Now my not yet localized message works fine. :-)

I just had another idea.
Would it be comfortable for the user if we could provide an extra message for constraints (maybe also filters) which is show like a comment. E. g. we provide a message like 'This field is required.' right away, instead of complaining afterwards, that we didn't get enough data. An alternativ would be to put an additional class in the container like 'constraint_required filter_whitespace', that would give the opportunity to do some color or icon coding in css.

The rest will be answered stepwise ;-)

Greets,
Mario

_______________________________________________
Html-widget mailing list
Html-widget@lists.rawmode.org
http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget

Reply via email to