You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Hong Gia Dinh <hg...@sdcgrp.com> on 2002/12/11 11:23:34 UTC

i18n and xmlform combination- HELP


-----Original Message-----
From: Hong Gia Dinh 
Sent: 10 December 2002 15:10
To: 'cocoon-users@xml.apache.org'
Subject: RE: i18n and xmlform combination-HELP


I just applied i18n into the XMLForm sample of Cocoon2.1 like this, but it
cant apply i18n

in sitemap i declare :
<map:match pattern="*">
	<map:act type="WizardAction">
	<map:parameter name="xmlform-validator-schema-ns"
value="http://www.ascc.net/xml/schematron"/>
	<map:parameter name="xmlform-validator-schema"
value="wizard/validate.xml"/>
	<map:parameter name="xmlform-id" value="form-feedback"/>
	<map:parameter name="xmlform-scope" value="session"/>
	<map:parameter name="xmlform-model"
value="org.apache.cocoon.samples.xmlform.UserBean"/>
						
	<map:generate type="serverpages" src="wizard/{page}.xsp"/>

	<map:transform type="xmlform" label="xml"/>
	<map:transform src="stylesheets/translate.xsl"/>
	<map:act type="locale">
		<map:transform type="i18n">
			<map:parameter name="locale" value="vi"/>
		</map:transform>
	</map:act>
	
	<map:transform type="xalan" src="stylesheets/wizard2html.xsl"/>
	<map:transform src="stylesheets/xmlform2html.xsl"/>
	
	<map:act type="locale">
		<map:transform type="i18n">
			<map:parameter name="locale" value="vi"/>
		</map:transform>
	</map:act>
							
	<map:serialize type="html"/>
</map:act>
</map:match>

and my start.xsp like this:

<?xml version="1.0"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.0">
<document>
	<menu>
		<lang>
		<href>start?locale=en</href>
		<title>English</title>
		</lang>
		<lang>
			<href>start?locale=fr</href>
		<title>French</title>
		</lang>
	</menu>
	<br/>
	<br/>
	<br/>
	<table align="center" width="50%" cellspacing="20">
		<tr>
			<td align="center">
				<h3>
			<a href="wizard?cocoon-action-start=true">
<i18n:text>homepage</i18n:text>
						</a>
					</h3>
				</td>
			</tr>
		</table>
	</document>
</xsp:page>

and my userIdentity.xsp like this :

<?xml version="1.0"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.0">
	<document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
		<menu>
			<lang>
	
<href>wizard?cocoon-action-start=true&amp;locale=en</href>

				<title>English</title>
			</lang>
			<lang>
	
<href>wizard?cocoon-action-start=true&amp;locale=fr</href>
				
				<title>French</title>
			</lang>
		</menu>
		<xf:form id="form-feedback" view="userIdentity"
action="wizard" method="GET">
			<xf:caption>
				<i18n:text>personal_information</i18n:text>
			</xf:caption>

.....

and wizard2html.xsl :



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002"
	exclude-result-prefixes="xalan"
xmlns:i18n="http://apache.org/cocoon/i18n/2.0">
	<xsl:template match="document">
		<html>
			<head>
		
			<title>XMLForm - Cocoon Feedback Wizard</title>
			</head>
			<body>
				<xsl:apply-templates />
			</body>
		</html>
	</xsl:template>
	
	<xsl:template match="menu">
		<xsl:for-each select="lang">
			<a href="{href}"><xsl:value-of select="title"/></a>
		</xsl:for-each>
	</xsl:template>
....

but every time i click to change from english to french in the userIdentify
form and even in the english form the part "
			<xf:caption>
				<i18n:text>personal_information</i18n:text>
			</xf:caption>

" always display 'personal_information' (message key)- not 'Personal
Information'

although i define the messages files and in sitemap :

			<map:transformer logger="sitemap.transformer.i18n"
name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
				<catalogue-name>messages</catalogue-name>
	
<catalogue-location>translation</catalogue-location>
				<cache-at-startup>true</cache-at-startup>
			</map:transformer>

for the directory and the file!!!!

i am really getting crazy with it!!

can somebody tell me what i did wrong ???

thanks very very much in advance
GD











-----Original Message-----
From: Kirchhoff, Lars [mailto:Lars.Kirchhoff@wincor-nixdorf.com]
Sent: 10 December 2002 13:54
To: 'cocoon-users@xml.apache.org'
Subject: AW: i18n and xmlform combination-HELP


have you set the {locale} variable correctly or are you sure this working. 

my sitemap looks like this:

----- code -------------------------
 <map:act type="locale">		      
   <map:transform type="i18n">
     <map:parameter name="locale" value="{locale}"/>
   </map:transform>
 </map:act> 
----- /code ------------------------

try to set the locale parameter to a hard coded value to see if this is
working:
eg.	 <map:parameter name="locale" value="tw"/>

to reference a dictionary like dict_tw.xml

ciao Lars

-----Ursprüngliche Nachricht-----
Von: Hong Gia Dinh [mailto:hgdinh@sdcgrp.com]
Gesendet: Montag, 9. Dezember 2002 18:38
An: cocoon-users@xml.apache.org
Betreff: i18n and xmlform combination-HELP


could sb explain me why i cant use the message key in the message when i use
i18n and xmlform ? 
i applied the sample in the how-to i18n and xml form for my application but
it cant read the message key ? 


what will the link i will call for translation in xmlform? 
thanks very much in advance 
GD 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>

Re: i18n and xmlform combination- HELP

Posted by Konstantin Piroumian <kp...@apache.org>.
i18n and xmlform combination- HELPPlease do not use HTML messages!

Try to remove the LocaleAction and leave the:
<map:transform type="i18n" />
    <map:parameter name="locale" value="vi"/>
</map:transform>

if this helps, move the action to the beginning of the matcher and wrap with
it all the contents. Do not forget to change other parameters, e.g.:

        <map:generate type="serverpages" src="wizard/{../page}.xsp"/>
---------------------------------------------------------------------------^

Konstantin


----- Original Message -----
From: Hong Gia Dinh
To: cocoon-users@xml.apache.org
Sent: Wednesday, December 11, 2002 13:23
Subject: i18n and xmlform combination- HELP





-----Original Message-----
From: Hong Gia Dinh
Sent: 10 December 2002 15:10
To: 'cocoon-users@xml.apache.org'
Subject: RE: i18n and xmlform combination-HELP


I just applied i18n into the XMLForm sample of Cocoon2.1 like this, but it
cant apply i18n
in sitemap i declare :
<map:match pattern="*">
        <map:act type="WizardAction">
        <map:parameter name="xmlform-validator-schema-ns"
value="http://www.ascc.net/xml/schematron"/>
        <map:parameter name="xmlform-validator-schema"
value="wizard/validate.xml"/>
        <map:parameter name="xmlform-id" value="form-feedback"/>
        <map:parameter name="xmlform-scope" value="session"/>
        <map:parameter name="xmlform-model"
value="org.apache.cocoon.samples.xmlform.UserBean"/>

        <map:generate type="serverpages" src="wizard/{page}.xsp"/>
        <map:transform type="xmlform" label="xml"/>
        <map:transform src="stylesheets/translate.xsl"/>
        <map:act type="locale">
                <map:transform type="i18n">
                        <map:parameter name="locale" value="vi"/>
                </map:transform>
        </map:act>

        <map:transform type="xalan" src="stylesheets/wizard2html.xsl"/>
        <map:transform src="stylesheets/xmlform2html.xsl"/>

        <map:act type="locale">
                <map:transform type="i18n">
                        <map:parameter name="locale" value="vi"/>
                </map:transform>
        </map:act>

        <map:serialize type="html"/>
</map:act>
</map:match>
and my start.xsp like this:
<?xml version="1.0"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.0">
<document>
        <menu>
                <lang>
                <href>start?locale=en</href>
                <title>English</title>
                </lang>
                <lang>
                        <href>start?locale=fr</href>
                <title>French</title>
                </lang>
        </menu>
        <br/>
        <br/>
        <br/>
        <table align="center" width="50%" cellspacing="20">
                <tr>
                        <td align="center">
                                <h3>
                        <a href="wizard?cocoon-action-start=true">
<i18n:text>homepage</i18n:text>
                                                </a>
                                        </h3>
                                </td>
                        </tr>
                </table>
        </document>
</xsp:page>
and my userIdentity.xsp like this :
<?xml version="1.0"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.0">
        <document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">
                <menu>
                        <lang>

<href>wizard?cocoon-action-start=true&amp;locale=en</href>
                                <title>English</title>
                        </lang>
                        <lang>

<href>wizard?cocoon-action-start=true&amp;locale=fr</href>

                                <title>French</title>
                        </lang>
                </menu>
                <xf:form id="form-feedback" view="userIdentity"
action="wizard" method="GET">
                        <xf:caption>
                                <i18n:text>personal_information</i18n:text>
                        </xf:caption>
.....
and wizard2html.xsl :



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002"
        exclude-result-prefixes="xalan"
xmlns:i18n="http://apache.org/cocoon/i18n/2.0">
        <xsl:template match="document">
                <html>
                        <head>

                        <title>XMLForm - Cocoon Feedback Wizard</title>
                        </head>
                        <body>
                                <xsl:apply-templates />
                        </body>
                </html>
        </xsl:template>

        <xsl:template match="menu">
                <xsl:for-each select="lang">
                        <a href="{href}"><xsl:value-of select="title"/></a>
                </xsl:for-each>
        </xsl:template>
....
but every time i click to change from english to french in the userIdentify
form and even in the english form the part "
                        <xf:caption>
                                <i18n:text>personal_information</i18n:text>
                        </xf:caption>
" always display 'personal_information' (message key)- not 'Personal
Information'
although i define the messages files and in sitemap :
                        <map:transformer logger="sitemap.transformer.i18n"
name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
                                <catalogue-name>messages</catalogue-name>

<catalogue-location>translation</catalogue-location>
                                <cache-at-startup>true</cache-at-startup>
                        </map:transformer>
for the directory and the file!!!!
i am really getting crazy with it!!
can somebody tell me what i did wrong ???
thanks very very much in advance
GD











-----Original Message-----
From: Kirchhoff, Lars [mailto:Lars.Kirchhoff@wincor-nixdorf.com]
Sent: 10 December 2002 13:54
To: 'cocoon-users@xml.apache.org'
Subject: AW: i18n and xmlform combination-HELP


have you set the {locale} variable correctly or are you sure this working.
my sitemap looks like this:
----- code -------------------------
 <map:act type="locale">
   <map:transform type="i18n">
     <map:parameter name="locale" value="{locale}"/>
   </map:transform>
 </map:act>
----- /code ------------------------
try to set the locale parameter to a hard coded value to see if this is
working:
eg.      <map:parameter name="locale" value="tw"/>
to reference a dictionary like dict_tw.xml
ciao Lars
-----Ursprüngliche Nachricht-----
Von: Hong Gia Dinh [mailto:hgdinh@sdcgrp.com]
Gesendet: Montag, 9. Dezember 2002 18:38
An: cocoon-users@xml.apache.org
Betreff: i18n and xmlform combination-HELP


could sb explain me why i cant use the message key in the message when i use
i18n and xmlform ?
i applied the sample in the how-to i18n and xml form for my application but
it cant read the message key ?


what will the link i will call for translation in xmlform?
thanks very much in advance
GD
---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>