cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: general.field-required translation not working
Date Wed, 18 Jan 2006 14:52:58 GMT
On Wed, 2006-01-18 at 07:29 -0700, Jason Johnston wrote:
> Joost Kuif wrote:
> > Hi,
> > 
> > I'm using cforms and trying to override the general.field-required
> > message for the empty but 'required' (in formdefinition) fields. 
> > I have the line below in a messages.xml:
> > 
> > <message key="general.field-required">Dit is een verplicht
> > veld.</message>
> > 
> > For testing purposes: If i specify this key in a label of a field, the
> > string "Dit is een veplicht veld" is correctly translated for this
> > field-label. So cocoon is able to find the needed key in my messages.xml
> > with the keys i specify in the formdefinition. 
> > 
> > Only the translation for required="true" in the <fd:field> tag is NOT
> > translated into a proper message if a user leaves a (required) field
> > empty.
> >  
> > AFAIK this should be handled somewhere in the forms*.xsl pages.
> > Unfortunalely i cannot find the problem. Can someone help me? Thanks a
> > lot!
> > 
> > 
> > Joost.
> > 
> > 
> > Example:
> > The code below works, the specified label is overruled by the one in my
> > messages.xml:
> > 
> > <fd:label>
> > <i18n:text i18n:key="general.field-required">this should be
> > overruled</i18n:text>
> > </fd:label>
> 
> 
> The i18n elements produced by CForms all have an attribute 
> i18n:catalogue="forms", which means that the i18n transformer will 
> always look for a catalogue configured with the id "forms" to get its 
> translations for these elements.  The example above works because you're 
> not telling it to use a specific catalogue, so it uses whichever default 
> catalogue you have configured in your sitemap.
> 
> You need to have something like this in your sitemap:
> 
> <map:transformer name="i18n" 
> src="org.apache.cocoon.transformation.I18nTransformer">
>     <catalogues default="default">
>        <catalogue id="forms" name="Messages" location="path/to/forms"/>
>        <catalogue id="default" name="Messages" location="path/to/i18n"/>
>     </catalogues>
> </map:transformer>
> 
> And make sure your overridden CForms messages are in the "forms" 
> catalogue.  See the I18nTransformer docs for more details about setting 
> up catalogues.

More specifically,  it is also possible to avoid duplicating the entire
forms catalogue by having a config like this:

<map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
    <catalogues default="default">
       <catalogue id="forms" name="messages">
         <location>path/to/custom-i18n</location>
         <location>resource://org/apache/cocoon/forms/system/i18n</location>
       </catalogue>
       <catalogue id="default" name="Messages" location="path/to/i18n"/>
    </catalogues>
</map:transformer>

The path/to/custom-i18n directory would contain a file called
messages(_lang).xml in which you only need to redefine the messages you
want to change.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message