You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by js...@apache.org on 2001/05/05 19:15:17 UTC

cvs commit: jakarta-taglibs/i18n/examples/web format_include.jsf format.jsp format_include.jsp

jstrachan    01/05/05 10:15:17

  Modified:    i18n     build.xml
               i18n/examples/web format.jsp
  Added:       i18n/conf i18n.tld
               i18n/examples/web format_include.jsf
  Removed:     i18n     build.bat build.sh
               i18n/conf taglib.tld
               i18n/examples/web format_include.jsp
  Log:
  Ported the build over to the new common.xml build file. I also used the .jsf extension for a JSP fragment format_include.jsp to avoid confusion in some IDEs and tools
  
  Revision  Changes    Path
  1.3       +7 -197    jakarta-taglibs/i18n/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/i18n/build.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- build.xml	2001/04/28 15:05:42	1.2
  +++ build.xml	2001/05/05 17:15:15	1.3
  @@ -1,202 +1,12 @@
  -<!-- ANT Build Script for the "jspspec" Custom Tag Library -->
  -<!-- $Id: build.xml,v 1.2 2001/04/28 15:05:42 jstrachan Exp $ -->
  -<project name="i18n" default="main" basedir=".">
  +<?xml version="1.0"?>
   
  -    <!-- ******************** Adjustable Properties *********************** -->
  +<!DOCTYPE project [
  +    <!ENTITY common SYSTEM "file:../common.xml">
  +]>
   
  -    <!--
  +<project name="i18n" default="main">
   
  -        The following property values should be examined and customized
  -	for each custom tag library subproject.
  +  &common;
   
  -	ant.home                    Home directory for the ANT build tool
  -	                            This is normally defaulted from the
  -				    ANT_HOME environment variable in the
  -				    build script.
  -
  -	servlet.jar                 Pathname of the servlet API classes
  -	                            you are using to compile, such as the
  -				    one that comes with Tomcat.  This is
  -				    normally defaulted from the SERVLET_JAR
  -				    environment variable in the build script.
  -
  -        taglib.name		    Base name of this tag library subproject.
  -
  -    -->
  -
  -    <property name="taglib.name"    value="i18n"/>
  -
  -    <!-- ****************** Project Standard Properties ******************* -->
  -
  -    <!--
  -
  -        The following property values reflect the standard directory
  -	organization for the jakarta-taglibs project, and should not
  -	be changed or overridden.
  -
  -	build.dir                   Base directory for build targets
  -	dist.dir                    Base directory for distribution targets
  -        taglibs.xsl                 Taglibs stylesheet
  -
  -    -->
  -
  -    <property name="build.dir"      value="../../build/taglibs"/>
  -    <property name="dist.dir"       value="../../dist/taglibs"/>
  -    <property name="taglibs.xsl"    value="../../../src/doc/stylesheets/taglibs.xsl"/>
  -
  -    <!-- *********************** Default Properties ********************** -->
  -
  -    <!--
  -
  -        The following property values reflect the recommended directory
  -	structure for each custom tag library subproject.  You should only
  -	need to adjust or override them if you use a different organization.
  -
  -	conf.src                    Library configuration source directory
  -        doc.src                     Documentation app source directory
  -        examples.src                Examples app source directory
  -        library.src                 Library Java source directory
  -
  -    -->
  -
  -    <property name="conf.src"       value="conf"/>
  -    <property name="doc.src"        value="doc"/>
  -    <property name="examples.src"   value="examples"/>
  -    <property name="library.src"    value="src"/>
  -
  -
  -    <!-- ********************* Derived Properties ************************* -->
  -
  -    <!--
  -
  -        These property values are derived from the previously defined values,
  -	and should not normally be overridden from the command line.
  -
  -        build.doc                   Target directory for documentation app
  -        build.examples		    Target directory for examples app
  -        build.library               Target directory for tag library
  -	dist.doc                    Destination WAR for documentation app
  -	dist.examples		    Destination WAR for examples app
  -	dist.library                Destination JAR for tag library
  -	dist.tld                    Destination TLD file for tag library
  -
  -    -->
  -
  -    <property name="build.doc"      value="${build.dir}/${taglib.name}-doc"/>
  -    <property name="build.examples" value="${build.dir}/${taglib.name}-examples"/>
  -    <property name="build.library"  value="${build.dir}/${taglib.name}"/>
  -    <property name="dist.doc"       value="${dist.dir}/${taglib.name}/${taglib.name}-doc.war"/>
  -    <property name="dist.examples"  value="${dist.dir}/${taglib.name}/${taglib.name}-examples.war"/>
  -    <property name="dist.library"   value="${dist.dir}/${taglib.name}/${taglib.name}.jar"/>
  -    <property name="dist.tld"       value="${dist.dir}/${taglib.name}/${taglib.name}.tld"/>
  -
  -
  -  <!-- ********************** Destination Preparation ********************* -->
  -
  -  <target name="prepare">
  -    <!-- Set up build directories -->
  -    <mkdir dir="${build.dir}"/>
  -    <mkdir dir="${build.doc}"/>
  -    <mkdir dir="${build.doc}/WEB-INF"/>
  -    <mkdir dir="${build.doc}/WEB-INF/classes"/>
  -    <mkdir dir="${build.doc}/WEB-INF/lib"/>
  -    <mkdir dir="${build.examples}"/>
  -    <mkdir dir="${build.examples}/WEB-INF"/>
  -    <mkdir dir="${build.examples}/WEB-INF/classes"/>
  -    <mkdir dir="${build.examples}/WEB-INF/lib"/>
  -    <mkdir dir="${build.library}"/>
  -    <mkdir dir="${build.library}/META-INF"/>
  -    <!-- Set up distribution directory -->
  -    <mkdir dir="${dist.dir}"/>
  -    <mkdir dir="${dist.dir}/${taglib.name}"/>
  -  </target>
  -
  -
  -  <!-- **************** Compile Tag Library Components ******************** -->
  -
  -  <!-- Compile the documentation application -->
  -  <target name="documentation" depends="prepare">
  -    <copy todir="${build.doc}/WEB-INF">
  -      <fileset dir="${doc.src}/conf"/>
  -    </copy>
  -    <style basedir="${doc.src}/web" destdir="${build.doc}"
  -      extension=".html" style="${taglibs.xsl}" includes="*.xml"/>
  -    <copy todir="${build.doc}">
  -      <fileset dir="${doc.src}/web">
  -        <include name="**/*.html"/>
  -      </fileset>
  -    </copy>
  -  <!--
  -    <javac srcdir="${doc.src}/src"   destdir="${build.doc}/WEB-INF/classes"
  -           classpath="${servlet.jar}" debug="on"/>
  -    -->
  -  </target>
  -
  -  <!-- Compile the examples application -->
  -  <target name="examples" depends="library-dist">
  -    <copy toDir="${build.examples}/WEB-INF">
  -      <fileset dir="${examples.src}/conf"/>
  -    </copy>
  -    <copy toDir="${build.examples}" overwrite="yes">
  -      <fileset dir="${examples.src}/web"/>
  -    </copy>
  -    <copy file="${dist.tld}"
  -          toFile="${build.examples}/WEB-INF/${taglib.name}.tld"/>
  -    <copy file="${dist.library}"
  -          toFile="${build.examples}/WEB-INF/lib/${taglib.name}.jar"/>
  -    <javac srcdir="${examples.src}/src"
  -           destdir="${build.examples}/WEB-INF/classes"
  -           classpath="${servlet.jar}" debug="on"/>
  -    <copy todir="${build.examples}/WEB-INF/classes">
  -      <fileset dir="${examples.src}/src">
  -        <include name="**/*.properties"/>
  -      </fileset>
  -    </copy>
  -  </target>
  -
  -  <!-- Compile the tag library itself -->
  -  <target name="library" depends="prepare">
  -    <copy file="${conf.src}/taglib.tld"
  -          toFile="${build.library}/META-INF/taglib.tld"/>
  -    <javac srcdir="${library.src}" destdir="${build.library}"
  -           classpath="${servlet.jar}" debug="on"/>
  -  </target>
  -
  -  <!-- Compile the library as well as the associated applications -->
  -  <target name="main" depends="library,documentation,examples"/>
  -
  -
  -  <!-- ******************* Create Distribution Files ********************** -->
  -
  -  <!-- Create the documentation application WAR file -->
  -  <target name="documentation-dist" depends="documentation">
  -    <jar jarfile="${dist.doc}" basedir="${build.doc}"/>
  -  </target>
  -
  -  <!-- Create the examples application WAR file -->
  -  <target name="examples-dist" depends="examples">
  -    <jar jarfile="${dist.examples}" basedir="${build.examples}"/>
  -  </target>
  -
  -  <!-- Create the library distribution files -->
  -  <target name="library-dist" depends="library">
  -    <jar jarfile="${dist.library}" basedir="${build.library}"/>
  -    <copy file="${conf.src}/taglib.tld" toFile="${dist.tld}"/>
  -  </target>
  -
  -  <!-- Create the entire set of distribution files -->
  -  <target name="dist" depends="library-dist,examples-dist,documentation-dist"/>
  -
  -
  -
  -  <!-- ************************ Utility Commands ************************** -->
  -
  -  <!-- Delete output directories and files so we can build from scratch -->
  -  <target name="clean">
  -    <delete dir="${build.doc}"/>
  -    <delete dir="${build.examples}"/>
  -    <delete dir="${build.library}"/>
  -    <delete dir="${dist.dir}/${taglib.name}"/>
  -  </target>
  -
   </project>
  +
  
  
  
  1.1                  jakarta-taglibs/i18n/conf/i18n.tld
  
  Index: i18n.tld
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" ?>
  <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
  
  <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>i18n</shortname>
    <info>
      These are WAM!NET internationalization tags.
    </info>
  
    <tag>
      <name>bundle</name>
      <tagclass>org.apache.taglibs.i18n.BundleTag</tagclass>
      <info>Must be placed in a JSP before any other i18n tags.</info>
      <attribute>
        <name>baseName</name>
        <required>true</required>
      </attribute>
      <attribute>
        <name>locale</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>localeAttribute</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>message</name>
      <tagclass>org.apache.taglibs.i18n.MessageTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>Must occur after a localize tag.</info>
      <attribute>
        <name>key</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>args</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>messageArg</name>
      <tagclass>org.apache.taglibs.i18n.MessageArgumentTag</tagclass>
      <info>Must be nested inside a message tag.</info>
      <attribute>
        <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>ifdef</name>
      <tagclass>org.apache.taglibs.i18n.IfdefTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>Must occur after a localize tag.</info>
      <attribute>
        <name>key</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>ifndef</name>
      <tagclass>org.apache.taglibs.i18n.IfndefTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>Must occur after a localize tag.</info>
      <attribute>
        <name>key</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
  
    <!-- new formatting tags --> 
  
    <tag>
      <name>locale</name>
      <tagclass>org.apache.taglibs.i18n.LocaleTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
          Defines a locale context. This is either sepecified using the 
          locale property, the combination of 'language', 'country' and 
          the optional 'variant' property or the current HTTP request is used.
          If no other locale can be found then the default JVM locale is used.
          Other sub-tags will use this locale if no other locale is specified.
      </info>
      <attribute>
        <name>locale</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>language</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>country</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>variant</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>formatString</name>
      <tagclass>org.apache.taglibs.i18n.FormatStringTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
          Outputs a String value or displays the defaultText property if the 
          String is null. The defaultText defaults to "".
      </info>
      <attribute>
        <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>defaultText</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>formatNumber</name>
      <tagclass>org.apache.taglibs.i18n.FormatNumberTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
          Formats a number using a locale.
  
          A pattern can be specified such as '##,###.##'.
  
          If the value is null then the default text is used.
  
          If no locale is specified then the parent &lt;i18n:locale&gt; tag is used.
          If no parent &lt;i18n:locale&gt; tag exists then the locale is taken from the
          current request. If still no locale could be found then the 
          current JVM locale is used.
      </info>
      <attribute>
        <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>pattern</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>locale</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>defaultText</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>formatCurrency</name>
      <tagclass>org.apache.taglibs.i18n.FormatCurrencyTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
          Formats a number as a currency using a locale.
  
          If the value is null then the default text is used.
  
          If no locale is specified then the parent &lt;i18n:locale&gt; tag is used.
          If no parent &lt;i18n:locale&gt; tag exists then the locale is taken from the
          current request. If still no locale could be found then the 
          current JVM locale is used.
      </info>
      <attribute>
        <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>locale</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>defaultText</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>formatPercent</name>
      <tagclass>org.apache.taglibs.i18n.FormatPercentTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
          Formats a number as a percentage using a locale.
  
          If the value is null then the default text is used.
  
          If no locale is specified then the parent &lt;i18n:locale&gt; tag is used.
          If no parent &lt;i18n:locale&gt; tag exists then the locale is taken from the
          current request. If still no locale could be found then the 
          current JVM locale is used.
      </info>
      <attribute>
        <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>locale</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>defaultText</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>formatDate</name>
      <tagclass>org.apache.taglibs.i18n.FormatDateTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
          Formats a Date value as a time using a locale.
  
          A style (short/medium/long/full) can be specified
          or a pattern such as 'YYYY MMM ddd'.
  
          If the value is null then the default text is used.
  
          If no locale is specified then the parent &lt;i18n:locale&gt; tag is used.
          If no parent &lt;i18n:locale&gt; tag exists then the locale is taken from the
          current request. If still no locale could be found then the 
          current JVM locale is used.
      </info>
      <attribute>
        <name>value</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>style</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>pattern</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>locale</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>defaultText</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
  
    <tag>
      <name>formatDateTime</name>
      <tagclass>org.apache.taglibs.i18n.FormatDateTimeTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
          Formats a Date value as a date-time using a locale.
  
          A dateStyle and a timeStyle (short/medium/long/full) can be specified.
  
          If the value is null then the default text is used.
  
          If no locale is specified then the parent &lt;i18n:locale&gt; tag is used.
          If no parent &lt;i18n:locale&gt; tag exists then the locale is taken from the
          current request. If still no locale could be found then the 
          current JVM locale is used.
      </info>
      <attribute>
        <name>value</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>dateStyle</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>timeStyle</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>locale</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>defaultText</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
    <tag>
      <name>formatTime</name>
      <tagclass>org.apache.taglibs.i18n.FormatTimeTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
          Formats a Date value as a time using a locale.
  
          A style (short/medium/long/full) can be specified.
  
          If the value is null then the default text is used.
  
          If no locale is specified then the parent &lt;i18n:locale&gt; tag is used.
          If no parent &lt;i18n:locale&gt; tag exists then the locale is taken from the
          current request. If still no locale could be found then the 
          current JVM locale is used.
      </info>
      <attribute>
        <name>value</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>style</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>locale</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
      <attribute>
        <name>defaultText</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
  
  </taglib>
  
  
  
  1.3       +4 -4      jakarta-taglibs/i18n/examples/web/format.jsp
  
  Index: format.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/i18n/examples/web/format.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- format.jsp	2001/04/29 05:27:47	1.2
  +++ format.jsp	2001/05/05 17:15:17	1.3
  @@ -20,7 +20,7 @@
   
   <i18n:locale locale="<%= Locale.US %>">
   
  -<%@ include file="format_include.jsp" %>
  +<%@ include file="format_include.jsf" %>
   
   </i18n:locale>
   
  @@ -29,14 +29,14 @@
   
   <i18n:locale locale="<%= Locale.FRANCE %>">
   
  -<%@ include file="format_include.jsp" %>
  +<%@ include file="format_include.jsf" %>
   
   </i18n:locale>
   
   
   <h2>Default Request Locale</h2>
   
  -<%@ include file="format_include.jsp" %>
  +<%@ include file="format_include.jsf" %>
   
   
   <%
  @@ -54,7 +54,7 @@
   
   <i18n:locale country="<%= country %>" language="<%= language %>">
   
  -<%@ include file="format_include.jsp" %>
  +<%@ include file="format_include.jsf" %>
   
   </i18n:locale>
   
  
  
  
  1.1                  jakarta-taglibs/i18n/examples/web/format_include.jsf
  
  Index: format_include.jsf
  ===================================================================
  <h3>The time is now:-</h3>
  
  <ul>
  <li>
      <i18n:formatTime/> (default)
  </li>
  <li>
      <i18n:formatTime style="short"/> (short)
  </li>
  <li>
      <i18n:formatTime style="medium"/> (medium)
  </li>
  <li>
      <i18n:formatTime style="full"/> (full)
  </li>
  </ul>
  
  
  <h3>The date is now:-</h3>
  
  <ul>
  <li>
      <i18n:formatDate/> (default)
  </li>
  <li>
      <i18n:formatDate pattern="yyyy MMMMM ddd hh:mm:ss"/> (pattern)
  </li>
  <li>
      <i18n:formatDate style="short"/> (short)
  </li>
  <li>
      <i18n:formatDate style="medium"/> (medium)
  </li>
  <li>
      <i18n:formatDate style="full"/> (full)
  </li>
  </ul>
  
  
  <h3>The datetime is now:-</h3>
  
  <ul>
  <li>
      <i18n:formatDateTime/> (default)
  </li>
  <li>
      <i18n:formatDateTime dateStyle="short" timeStyle="short"/> (short, short)
  </li>
  <li>
      <i18n:formatDateTime dateStyle="medium" timeStyle="medium"/> (medium, medium)
  </li>
  <li>
      <i18n:formatDateTime dateStyle="full" timeStyle="full"/> (full, full)
  </li>
  </ul>
  
  
  <h3>The number is:-</h3>
  
  <ul>
  <li>
      <i18n:formatNumber value="<%= n %>"/> (number)
  </li>
  <li>
      <i18n:formatNumber value="<%= n %>" pattern="##,###,###.##"/> (number with pattern)
  </li>
  <li>
      <i18n:formatCurrency value="<%= n %>"/> (currency)
  </li>
  <li>
      <i18n:formatPercent value="<%= n %>"/> (percent)
  </li>
  </ul>