cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <mel...@gmail.com>
Subject Re: Fixing i18n required messages
Date Fri, 18 Feb 2005 12:00:14 GMT
Just to confirm the sample apps have the same bug.. I guess that got
missed while everyone was rapid application developing at such a fast
pace..

Interestingly there's no static variable I18N_CATALOGUE in Contants,
unless its secretly added during some tourtured build process.. Also
interesting there's no obvious error when this fails, this could
perhaps be something to do with a finally block that claims the field
is validated even in the event of an error here's the comment:

// Consider validation finished even in case of exception
this.valueState = VALUE_VALIDATED;

I cant express how impressed I am. 

Mark

On Thu, 17 Feb 2005 16:17:54 +0100, Mark Lowe <melowe@gmail.com> wrote:
> I've got all that working (localized error messages) and such like,
> thats all find and dandy. Its just the required field.. The situation
> has been complicated where I'm walking into a project thats already in
> progress and, So this could be down to the xslt for form rendering.
> 
> However I was reading that the required attribute and rendering a
> localised message wasn't working in the sample either. So I thought
> I'd take a look into it, rather than whining about it. Guess ist time
> to run the examples again to see if they do what they say on the box.
> 
> Mark
> 
> On Thu, 17 Feb 2005 15:49:06 +0100 (CET), Daniele Madama
> <d.madama@pro-netics.com> wrote:
> >
> > > I found that, and yes of course I have the message keys added.. You
> > > should try it, practice is usually better than theory. I've seen this
> > > mentioned elsewhere, if its a bug I'd prefer to submit a patch when i
> > > enter it rather than just joining a que.
> >
> > If you see the form-instance you can found the declaration of
> > validation-message
> >
> > <i18n:text i18n:catalogue="forms">general.field-required</i18n:text>
> >
> > so this message must be in the 'forms' catalogue, if you want to have the
> > message in the same file of other message you can simply add another
> > catalogue on the declaration of I18nTransformer that point on the same
> > file
> >
> >      <map:transformer
> >        name="i18n"
> >        label="i18n"
> >        logger="sitemap.transformer.i18n"
> >        src="org.apache.cocoon.transformation.I18nTransformer">
> >          <catalogues default="messages">
> >            <catalogue id="messages" name="messages"
> > location="resources/translations"/>
> >            <catalogue id="forms" name="messages"
> > location="resources/translations"/>
> >          </catalogues>
> >          <cache-at-startup>false</cache-at-startup>
> >      </map:transformer>
> >
> > in this code both catalogue point to the same file.
> >
> > Is this all or your sitatuion is different?
> >
> > TIA,
> > Best regards
> >
> > >
> > > On Thu, 17 Feb 2005 11:40:37 +0100 (CET), Daniele Madama
> > > <d.madama@pro-netics.com> wrote:
> > >>
> > >> > Hello
> > >> >
> > >> > Could someone nudge me in the right direction (i.e. where to start
> > >> > looking) if i wanted to get a patch in to fix this annoying i18n
> > >> > required messages problem.
> > >> >
> > >> > Thanks
> > >> >
> > >> > Mark
> > >> >
> > >>
> > >> If you are looking for the i18n of the cforms required message, is
> > >> already
> > >> done in the o.a.c.forms.formmodel.Field class
> > >>
> > >> <snip>
> > >>            if (this.value == null && getFieldDefinition().isRequired())
> > >> {
> > >>                // Field is required
> > >>                this.validationError = new ValidationError(new
> > >> I18nMessage("general.field-required",
> > >> Constants.I18N_CATALOGUE));
> > >>            } else {
> > >> </snip>
> > >>
> > >> So the only things is to add the correct message entry in the i18n
> > >> catalog.
> > >>
> > >> I hope this is what you need.
> > >>
> > >> Best regards
> > >>
> > >> --
> > >> Daniele Madama
> > >>
> > >> Pro-netics s.r.l.
> > >> Via Elio Lampridio Cerva 127/c
> > >> Roma
> > >> Tel. 0651530849
> > >> http://www.pro-netics.com
> > >>
> > >
> >
> > --
> > Daniele Madama
> >
> > Pro-netics s.r.l.
> > Via Elio Lampridio Cerva 127/c
> > Roma
> > Tel. 0651530849
> > http://www.pro-netics.com
> >
>

Mime
View raw message