You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Fernando D. Mato Mira" <ma...@acm.org> on 2006/03/16 14:42:48 UTC

Cannot override general.field-required

Hi again,

  I have looked up how to override the CForms localization, but it's now 
working.

In my subsitemap I have:

    <map:transformers default="xslt">
      <map:transformer name="i18n" 
src="org.apache.cocoon.transformation.I18nTransformer">
            <catalogues default="default">
              <catalogue id="forms" name="messages">
                <location>resources/i18n</location>
                
<location>resource://org/apache/cocoon/forms/system/i18n</location>
              </catalogue>
              <catalogue id="default" name="messages" 
location="resources/i18n"/>
            </catalogues>
          </map:transformer>
    </map:transformers>


In resources/i18n/messages.xml I have:

<?xml version="1.0" encoding="UTF-8"?>
<catalogue xml:lang="en">
<message key="general.field-required">This is a required field</message>
</catalogue>


But I keep on getting the untranslated key as the message.

Thanks,

-- 
--
Fernando D. Mato Mira                         matomira@acm.org
Thomson Corporation Switzerland AG


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


Re: Cannot override general.field-required

Posted by Simone Gianni <s....@thebug.it>.
Hi Fernando,
I18n transformer supports different bundles. That means that you can 
have different "root files" (each one then having it's localized 
versions) containing keys, and eventually even the same keys, and then 
specify in the i18n:text which boundle (again, not language, root 
bundle) to use.

Forms uses it's own bundle, called forms, and not the default one. So, 
to have forms internationalization, you have to configure this bundle, 
eventually even pointing it to the same file as your default application 
bundle.

To do this, i have this in my sitemap :

            <map:transformer name="i18n" 
src="org.apache.cocoon.transformation.I18nTransformer">
                <catalogues default="messages">
                    <catalogue id="messages" name="n_messages" 
location="resources/messages"/>
                    <catalogue id="forms" name="FormsMessages" 
location="resources/messages"/>
                </catalogues>
                <cache-at-startup>false</cache-at-startup>
            </map:transformer>

This basically tells the I18nTransformer that there are two bundles, one 
called messages the other one called forms, that the default one is the 
one called messages, that the messages bundle files can be found inside 
resources/messages and are called "n_messages*" (which means 
n_messages_IT, n_messages_EN, n_messages_FR etc..), while the forms 
bundle files are located in the same folder but are called 
"FormsMessages*" (which means FormsMessages_IT etc.. etc..).

This way, you can customize your forms error messages by adding keys to 
FormMessages_<language>, and also use the default forms bundle you can 
find in src/blocks/forms/java/org/apache/cocoon/forms/system/i18n/ .

Hope this helps,
Simone

Fernando D. Mato Mira wrote:

> Hi again,
>
>  I have looked up how to override the CForms localization, but it's 
> now working.
>
> In my subsitemap I have:
>
>    <map:transformers default="xslt">
>      <map:transformer name="i18n" 
> src="org.apache.cocoon.transformation.I18nTransformer">
>            <catalogues default="default">
>              <catalogue id="forms" name="messages">
>                <location>resources/i18n</location>
>                
> <location>resource://org/apache/cocoon/forms/system/i18n</location>
>              </catalogue>
>              <catalogue id="default" name="messages" 
> location="resources/i18n"/>
>            </catalogues>
>          </map:transformer>
>    </map:transformers>
>
>
> In resources/i18n/messages.xml I have:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <catalogue xml:lang="en">
> <message key="general.field-required">This is a required field</message>
> </catalogue>
>
>
> But I keep on getting the untranslated key as the message.
>
> Thanks,
>
-- 
Simone Gianni

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