cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kpiroum...@apache.org
Subject cvs commit: xml-cocoon2/src/webapp/samples/i18n menu.xml simple.xml simple.xsl simple.xsp site2html.xsl sitemap.xmap
Date Wed, 13 Nov 2002 22:37:00 GMT
kpiroumian    2002/11/13 14:37:00

  Modified:    src/webapp/samples/i18n menu.xml simple.xml simple.xsl
                        simple.xsp site2html.xsl sitemap.xmap
  Added:       src/webapp/samples/i18n/images f-cn.gif f-ja.gif f-ko.gif
                        f-tw.gif
  Log:
  Updated i18n samples to demonstrate
  new implementation of i18n transformer and supporting stuff.
  Thanks to mattam@netcourrier.com (Matthieu Sozeau).
  
  Added Korean, Japanese, Chinese translations
  thanks to IAS <iasandcb@apache-korea.org>.
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/webapp/samples/i18n/images/f-cn.gif
  
  	<<Binary file>>
  
  
  1.1                  xml-cocoon2/src/webapp/samples/i18n/images/f-ja.gif
  
  	<<Binary file>>
  
  
  1.1                  xml-cocoon2/src/webapp/samples/i18n/images/f-ko.gif
  
  	<<Binary file>>
  
  
  1.1                  xml-cocoon2/src/webapp/samples/i18n/images/f-tw.gif
  
  	<<Binary file>>
  
  
  1.3       +5 -1      xml-cocoon2/src/webapp/samples/i18n/menu.xml
  
  Index: menu.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/i18n/menu.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- menu.xml	30 May 2002 13:01:12 -0000	1.2
  +++ menu.xml	13 Nov 2002 22:37:00 -0000	1.3
  @@ -5,7 +5,7 @@
         title="Apache Cocoon i18n Samples" 
         copyright="1999-2002 The Apache Software Foundation"
         xmlns:xlink="http://www.w3.org/1999/xlink"
  -      xmlns:i18n="http://apache.org/cocoon/i18n/2.0"
  +      xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
         i18n:attr="title"
   >
   
  @@ -29,6 +29,10 @@
       <menu-item label="Polski" href="?locale=pl_PL" icon="images/f-pl.gif"/>     
      
       <menu-item label="гۻñ»Ý (Armenian)" href="?locale=hy_HY" icon="images/f-am.gif"/>
       <menu-item label="Türkçe" href="?locale=tr_TR" icon="images/f-tr.gif"/>
  +    <menu-item label="한글(대한민국)" href="?locale=ko_KR" icon="images/f-ko.gif"/>
  +    <menu-item label="日本語" href="?locale=ja_JP" icon="images/f-ja.gif"/>
  +    <menu-item label="汉语(简字体)" href="?locale=zh_CN" icon="images/f-cn.gif"/>
  +    <menu-item label="漢語(繁字體)" href="?locale=zh_TW" icon="images/f-tw.gif"/>
     </menu>
   
     <menu label="Documentation" i18n:attr="label">
  
  
  
  1.4       +30 -20    xml-cocoon2/src/webapp/samples/i18n/simple.xml
  
  Index: simple.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/i18n/simple.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- simple.xml	27 Apr 2002 09:42:13 -0000	1.3
  +++ simple.xml	13 Nov 2002 22:37:00 -0000	1.4
  @@ -1,5 +1,5 @@
   <?xml version="1.0" encoding="UTF-8"?>
  -<root xmlns:i18n="http://apache.org/cocoon/i18n/2.0">
  +<root xmlns:i18n="http://apache.org/cocoon/i18n/2.1" i18n:attr="language" language="language">
   	<title>
   		<i18n:text>titletext</i18n:text>
   	</title>
  @@ -7,13 +7,22 @@
   		<i18n:date-time pattern="FULL"/>
   	</sub-title>
   	<annotation>
  -		<i18n:text>doclink</i18n:text>
  -		<link>
  -			<href>http://xml.apache.org/cocoon/userdocs/transformers/i18n-transformer.html</href>
  -			<title>Cocoon 2 Web Site</title>
  -		</link>
  +		<i18n:translate>
  +			<i18n:text i18n:key="doclink"/>
  +			<i18n:param>
  +				<link>
  +					<href>http://xml.apache.org/cocoon/userdocs/transformers/i18n-transformer.html</href>
  +					<title>Cocoon 2 Web Site</title>
  +				</link>
  +			</i18n:param>
  +		</i18n:translate>
   	 </annotation>
   	<content>
  +		<i18n:if locale="ru">
  +                	<para title="ru" name="i18n:when">
  +				Этот текст отображается только для <strong>русского</strong>
языка.
  +			</para>
  +		</i18n:if>
   		<para title="first" name="article" i18n:attr="title name">
   			<i18n:text i18n:key="a_key">article_text1</i18n:text>
   		</para>
  @@ -22,31 +31,32 @@
   		</para>
   		<para title="third" name="article" i18n:attr="title name">
   			<i18n:translate>
  -				<i18n:text>Hello</i18n:text>
  -				<i18n:param name="username">
  -					<i18n:text>Kot</i18n:text>
  +				<i18n:text i18n:key="Hello"/>
  +				<i18n:param>
  +					<strong><i18n:text>Kot</i18n:text></strong>
   				</i18n:param>
   			</i18n:translate>
   		</para>
   		<para title="forth" name="article" i18n:attr="title name">
   			<i18n:translate>
  -				One = {0}, two = {1}, {2}! {3}
  -				This line is not translated {3}
  +				One = {one}, two = {two}, {third}! {forth} This line is not translated {forth}
   				<i18n:param name="one"><i18n:text>one</i18n:text></i18n:param>
   				<i18n:param name="two"><i18n:text>two</i18n:text></i18n:param>
   				<i18n:param name="third">baby</i18n:param>
   				<i18n:param name="forth"> ~ </i18n:param>
   			</i18n:translate>
   		</para>
  -			<para title="Number formatting (not translated)" name="article" i18n:attr="name">
  -				<i18n:translate>
  -					Number : {0} | Currency: {1} | Percent: {2}, processed on: {3}
  -					<i18n:param type="number" src-locale="en" value="1703.74" />
  -					<i18n:param type="currency" src-locale="en">27.24</i18n:param>
  -					<i18n:param type="percent" src-locale="en">1.2</i18n:param>
  -					<i18n:param type="date-time" pattern="MEDIUM"/>
  -				</i18n:translate>
  -			</para>
  +		<para title="Number formatting (not translated)" name="article" i18n:attr="name">
  +			<i18n:translate>
  +				Number: {0} | Currency: {1} | Percent: {2}, processed on: {3}
  +				<!--Old format: i18n:param type="number" src-locale="en" value="1703.74" /-->
  +				<i18n:param><i18n:number src-locale="en" value="1703.74"/></i18n:param>
  +				<!--Old format: i18n:param type="currency" src-locale="en">27.24</i18n:param-->
  +				<i18n:param><i18n:number type="currency" src-locale="en" value="27.24"/></i18n:param>
  +				<i18n:param><i18n:number type="percent" src-locale="en" value="1.2"/></i18n:param>
  +				<i18n:param><i18n:date-time pattern="MEDIUM"/></i18n:param>
  +			</i18n:translate>
  +		</para>
   	</content>
   	<bottom>
   		<copyright>
  
  
  
  1.4       +8 -3      xml-cocoon2/src/webapp/samples/i18n/simple.xsl
  
  Index: simple.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/i18n/simple.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- simple.xsl	26 Apr 2002 16:17:37 -0000	1.3
  +++ simple.xsl	13 Nov 2002 22:37:00 -0000	1.4
  @@ -1,7 +1,8 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  +
   	<xsl:template match="root">
  -	    <page>
  +	    <page language="{@language}">
   	                <title>
   	                    <xsl:value-of select="title" />
   	                </title>
  @@ -45,9 +46,13 @@
   	
   	<xsl:template match="para">
   		<p>
  -			<font color="navy"><b><xsl:value-of select="position() div 2"/>. <xsl:value-of
select="@name"/> </b>: <xsl:value-of select="@title"/></font><br/>
  -			<font size="-1"><xsl:value-of select="."/></font>
  +			<font color="navy"><b><xsl:number format="0. "/> <xsl:value-of
select="@name"/> </b>: <xsl:value-of select="@title"/></font><br/>
  +			<font size="-1"><xsl:apply-templates select="text() | strong"/></font>
   		</p>	
  +	</xsl:template>
  +	
  +	<xsl:template match="strong">
  +	    <b><xsl:apply-templates select="text()"/></b>
   	</xsl:template>
   	
   	<xsl:template match="bottom">
  
  
  
  1.5       +44 -30    xml-cocoon2/src/webapp/samples/i18n/simple.xsp
  
  Index: simple.xsp
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/i18n/simple.xsp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- simple.xsp	27 Apr 2002 09:42:13 -0000	1.4
  +++ simple.xsp	13 Nov 2002 22:37:00 -0000	1.5
  @@ -1,15 +1,19 @@
   <?xml version="1.0" encoding="UTF-8"?>
  -<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">
  +<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.1"
  +>
       <xsp:logic>
  -	private static int count = 0;
  -</xsp:logic>
  -    <root>
  +        private static int count = 0;
  +    </xsp:logic>
  +    <root i18n:attr="language" language="language">
           <xsp-request:get-session/>
           <xsp:logic>
  -		synchronized (this) {
  -			count++;
  -		}
  -    	</xsp:logic>
  +            synchronized (this) {
  +                count++;
  +            }
  +        </xsp:logic>
           <title>
               <i18n:text>titletext</i18n:text>
           </title>
  @@ -17,23 +21,29 @@
               <input type="text" name="username">
                   <xsp:attribute name="value"><xsp-request:get-parameter name="username"
default="[yourname]" as="string" form-encoding="UTF-8"/></xsp:attribute>
               </input>
  -            <input type="submit" name="submit" value="Submit" />
  +            <input type="submit" name="submit" value="Submit"/>
           </form>
           <annotation>
  -            <i18n:text>doclink</i18n:text>
  -            <link>
  -                <href>http://xml.apache.org/cocoon/userdocs/transformers/i18n-transformer.html</href>
  -                <title>Cocoon 2 Web Site</title>
  -            </link>
  +            <i18n:translate>
  +                <i18n:text i18n:key="doclink"/>
  +                <i18n:param>
  +                    <link>
  +                        <href>http://xml.apache.org/cocoon/userdocs/transformers/i18n-transformer.html</href>
  +                        <title>Cocoon 2 Web Site</title>
  +                    </link>
  +                </i18n:param>
  +            </i18n:translate>
           </annotation>
           <sub-title>
               <i18n:translate>
  -                <i18n:text>count_title</i18n:text>
  +                <i18n:text i18n:key="count_title"/>
                   <i18n:param type="number" pattern="000000">
                       <xsp:expr>count</xsp:expr>
                   </i18n:param>
  -                <i18n:param type="date-time" src-pattern="EEE MMM dd hh:mm:ss zzz yyyy"
src-locale="en" pattern="MEDIUM">
  -                    <xsp:expr>new Date()</xsp:expr>
  +                <i18n:param>
  +                    <i18n:date-time src-pattern="EEE MMM dd hh:mm:ss zzz yyyy" src-locale="en"
pattern="MEDIUM">
  +                        <xsp:expr>new Date()</xsp:expr>
  +                    </i18n:date-time>
                   </i18n:param>
               </i18n:translate>
           </sub-title>
  @@ -46,16 +56,18 @@
               </para>
               <para title="third" name="article" i18n:attr="title name">
                   <i18n:translate>
  -                    <i18n:text>Hello</i18n:text>
  +                    <i18n:text i18n:key="Hello"/>
                       <i18n:param>
  -                        <xsp-request:get-parameter name="username" default="none" as="string"
form-encoding="UTF-8"/>
  +                        <strong>
  +                            <xsp-request:get-parameter name="username" default="none"
as="string" form-encoding="UTF-8"/>
  +                        </strong>
                       </i18n:param>
                   </i18n:translate>
               </para>
               <para title="forth" name="article" i18n:attr="title name">
                   <i18n:translate>
  -				One = {0}, two = {1}, {2}! {3}
  -				This line is not translated {3}
  +				One = {one}, two = {two}, {third}! {forth}
  +				This line is not translated {forth}
   				<i18n:param name="one">
                           <i18n:text>
                               <xsp:expr>"ONE".toLowerCase()</xsp:expr>
  @@ -70,15 +82,17 @@
               </para>
               <para title="Number formatting (not translated)" name="article" i18n:attr="name">
                   <i18n:translate>
  -					Number : {0} | Currency: {1} | Percent: {2}, processed on: {3}
  -					<i18n:param type="number" src-locale="en">
  -                        <xsp:expr>17 + 3 + 1974</xsp:expr>
  -                    </i18n:param>
  -                    <i18n:param type="currency" src-locale="en">
  -                        <xsp:expr>2002.0 / 28.0</xsp:expr>
  -                    </i18n:param>
  -                    <i18n:param type="percent" src-locale="en">1.205</i18n:param>
  -                    <i18n:param type="date-time" pattern="MEDIUM"/>
  +		          Number: {0} | Currency: {1} | Percent: {2}, processed on: {3}
  +				<!--Old format: i18n:param type="number" src-locale="en" value="1703.74" /-->
  +				<i18n:param>
  +				    <i18n:number src-locale="en"><xsp:expr>17 + 3 + 1974</xsp:expr></i18n:number>
  +				</i18n:param>
  +				<!--Old format: i18n:param type="currency" src-locale="en">27.24</i18n:param-->
  +				<i18n:param>
  +				    <i18n:number type="currency" src-locale="en"><xsp:expr>2002.0 / 28.0</xsp:expr></i18n:number>
  +				</i18n:param>
  +				<i18n:param><i18n:number type="percent" src-locale="en" value="1.205"/></i18n:param>
  +				<i18n:param><i18n:date-time pattern="MEDIUM"/></i18n:param>
                   </i18n:translate>
               </para>
           </content>
  
  
  
  1.5       +1 -1      xml-cocoon2/src/webapp/samples/i18n/site2html.xsl
  
  Index: site2html.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/i18n/site2html.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- site2html.xsl	30 May 2002 13:13:17 -0000	1.4
  +++ site2html.xsl	13 Nov 2002 22:37:00 -0000	1.5
  @@ -1 +1 @@
  -<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:param name="locale" />
    <xsl:param name="page" />

    <xsl:template
match="site">
        <html>
            <head>
                <title>
                   <xsl:value-of select="page/title" />
                </title>
               <link rel="stylesheet" href="page.css" type="text/css"/>
           
</head>
            <body>
                <table class="path">
       
            <tr>
                        <td>
                            <a
href="../../">Apache Cocoon Main</a>&#160;&gt;&#160;<a href="../">Samples</a>&#160;&gt;&#160;<span
class="current">Internationalization (i18n) and Localization (l10n)</span>      
                 
                        </td>
                    </tr>
   
            </table>            
                <table class="topline"><tr><td>&#160;</td></tr></table>
               <table cellspacing="0" cellpadding="0" summary="content pane">
     
              <tr>
                        <td width="5" class="navbar">&#160;</td>
                       <td rowspan="2" valign="top" nowrap="nowrap" width="300">
  
                         <xsl:apply-templates select="table[@class='menu']"/>
     
                  </td>
                        <td valign="top" class="navbar" align="left">
                           Locale: <xsl:value-of select="$locale" />
              
         </td>
                        <td width="*" valign="top" class="navbar"
align="right">
                            Page: <xsl:value-of select="$page" />
                       </td>
                    </tr>
                    <tr>
                       <td>&#160;</td>
                        <td class="content"
valign="top" colspan="2">
                            <xsl:apply-templates select="page"/>
                       </td>
                    </tr>
                </table>
               <table>
                    <tr>
                        <td
class="copyright">
                            Copyright (c) 1999-2002 <a href="http://www.apache.org/">Apache
Software Foundation</a>. All Rights Reserved.
                        </td>
 
                  </tr>
                </table>
            </body>
  
     </html>
    </xsl:template>
    
    <xsl:template match="node()|@*" priority="-1">
       <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates/>
       </xsl:copy>
    </xsl:template>
    
</xsl:stylesheet>
  \ No newline at end of file
  +<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:param name="locale" />
    <xsl:param name="page" />

    <xsl:template
match="site">
        <html>
            <head>
                <title>
                   <xsl:value-of select="page/title" />
                </title>
               <link rel="stylesheet" href="page.css" type="text/css"/>
           
</head>
            <body>
                <table class="path">
       
            <tr>
                        <td>
                            <a
href="../../">Apache Cocoon Main</a>&#160;&gt;&#160;<a href="../">Samples</a>&#160;&gt;&#160;<span
class="current">Internationalization (i18n) and Localization (l10n)</span>      
                 
                        </td>
                    </tr>
   
            </table>            
                <table class="topline"><tr><td>&#160;</td></tr></table>
               <table cellspacing="0" cellpadding="0" summary="content pane">
     
              <tr>
                        <td width="5" class="navbar">&#160;</td>
                       <td rowspan="2" valign="top" nowrap="nowrap" width="300">
  
                         <xsl:apply-templates select="table[@class='menu']"/>
     
                  </td>
                        <td valign="top" class="navbar" align="left">
                           Language: <xsl:value-of select="page/@language" /> (<xsl:value-of
select="$locale" />)
                        </td>
                        <td
width="*" valign="top" class="navbar" align="right">
                            Page:
<xsl:value-of select="$page" />
                        </td>
               
    </tr>
                    <tr>
                        <td>&#160;</td>
                       <td class="content" valign="top" colspan="2">
              
             <xsl:apply-templates select="page"/>
                        </td>
                   </tr>
                </table>
                <table>
                   <tr>
                        <td class="copyright">
      
                     Copyright (c) 1999-2002 <a href="http://www.apache.org/">Apache
Software Foundation</a>. All Rights Reserved.
                        </td>
 
                  </tr>
                </table>
            </body>
  
     </html>
    </xsl:template>
    
    <xsl:template match="node()|@*" priority="-1">
       <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates/>
       </xsl:copy>
    </xsl:template>
    
</xsl:stylesheet>
  \ No newline at end of file
  
  
  
  1.6       +1 -1      xml-cocoon2/src/webapp/samples/i18n/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/i18n/sitemap.xmap,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- sitemap.xmap	20 Oct 2002 12:25:45 -0000	1.5
  +++ sitemap.xmap	13 Nov 2002 22:37:00 -0000	1.6
  @@ -18,8 +18,8 @@
           
           <map:readers default="resource"/>
           <map:serializers default="html"/>
  -        <map:matchers default="wildcard"/>
           <map:selectors default="browser"/>
  +        <map:matchers default="wildcard"/>
       
           <!-- =========================== Actions ================================= -->
  
           <map:actions>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message