cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <KPiroum...@flagship.ru>
Subject Re: Cocoon 2 and i18n
Date Fri, 01 Feb 2002 09:43:52 GMT
Please, use plain text format for your messages.
----- Original Message ----- 
From: Chitharanjan  <mailto:cdas@accordiasys.com> Das 
To: cocoon-users@xml.apache.org <mailto:cocoon-users@xml.apache.org>  
Sent: Friday, February 01, 2002 2:50 AM
Subject: Cocoon 2 and i18n


Hello,
 
 
My env is
Platform Win2K
Cocoon 2.0
TomCat 4.01
 
 
 
The following is my i18n transformer  definition
 
   <map:transformer     name="i18n"
src="org.apache.cocoon.transformation.I18nTransformer">
    <catalogue-name>messages</catalogue-name>
    <catalogue-location>i18n/translations</catalogue-location>
 
The following is my pattern definition for JSP's
 
<map:match pattern="jsp/**">
  <map:generate type="jsp" src="/docs/samples/jsp/{../1}.jsp"/>
   <map:transform type="i18n"/>
     <map:transform src="stylesheets/page/simple-page2html.xsl"/>
    <map:serialize type="html"/>
  </map:match>
 
The following is a simple JSP file
 
<%@ page language='java' session='false' %>
<page xmlns:i18n="http://apache.org/cocoon/i18n/2.0">
  <title>Hello</title>
 
  <content>
    <para>This is my first Cocoon2 page!</para>
    
    <para><i18n:text>a_key</i18n:text></para>
    
 </content>
</page>
 
 
The i18n/translations directory has the cfollwing files messages_en.xml
, messages _de.xml and messages.xml
 
When I started TomCat 4.01 with the above configurations, I got the
error
ERROR   (2002-01-31) 15:15.18:838   [cocoon  ] (/cocoon/jsp/hello2)
HttpProcessor[8080][1]/XMLResourceBundleFactory: Error while loading
resource: messages, locale en_US, bundleName
file:/C:/Products/WebServers/TomCat40/webapps/cocoon/i18n/translations/m
essages_en_US.xml
java.io.FileNotFoundException:
C:\Products\WebServers\TomCat40\webapps\cocoon\i18n\translations\message
s_en_US.xml (The system cannot find the file specified)
 
The cocoon was trying to find the messages_en_US.xml, however the
documentation indicates that the priority in finding the catalogue file
is
messages_lang_Country.xml
messages_country_lang.xml
messages_lang.xml
messages.xml
 
I then made a copy of messages_en.xml as messages_en_US.xml and started
cocoon and it started.
 
Hm, it's strange, because i18n samples in C2.0 work perfect either with
en or en_US locales.  
 
Question 1:
            Why does it fail if the catalogues file corresponding to
locale (lang_Country) is absent?
 
Are you sure that the path to catalogue is correct and any file is
present there?
 
Question 2:
            How do I specify to get translation of text in a different
language at run time ?
                        <para><i18n:text>a_key</i18n:text></para>
                        <para><i18n:text
locale="es_ES">a_key</i18n:text></para>\
                        <para><i18n:text
locale="de"">a_key</i18n:text></para>
 
            Note: The above formats to print in different languages
fails.
 
It is not supported now. Do you really need that? There were no demand
on this, except for date and number formatting, that do not require
dictionaries for different locales, so I didn't implement.
 
Question 3:
            How do I initialize the i18n transformers for different
locales?
 
What do you mean? i18n transformer uses
LocaleAction.getLocaleAttribute() to select the users locale based on
request or session parameter or a cookie.
 
Question 4:
            If any one has samples, would U be kind enough to mail it ?
 
See samples included with C2.0.
http://localhost:8080/cocoon/i18n/simple.xml
<http://localhost:8080/cocoon/i18n/simple.xml>  and
http://localhost:8080/cocoon/i18n/simple.xsp
<http://localhost:8080/cocoon/i18n/simple.xsp> 
 
Please tell me if you have any other problems or suggestions.
 
Regards, 
    Konstantin
 
Regds,
Chithjs
 
 
 
 
 
 
accordia, inc 
34347 Maybird Circle
Fremont, CA 94555
650 279 1137
cdas@accordiasys.com <mailto:cdas@accordiasys.com> 
 
The information contained in this communication is intended solely for
the use of the individual or entity to whom it is addressed and others
authorized to receive it. It may contain confidential or legally
privileged information. If you are not the intended recipient you are
hereby notified that any disclosure, copying, distribution or taking any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful. If you have received this communication
in error, please notify us immediately by responding to this email and
then delete it from your system. Accordia Inc. is neither liable for the
proper and incomplete transmission of the information contained in this
communication nor for any delay in its receipt
 

Mime
View raw message