You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2004/02/14 15:24:17 UTC

cvs commit: jakarta-turbine-fulcrum/localization/xdocs index.xml navigation.xml changes.xml

epugh       2004/02/14 06:24:17

  Added:       localization/impl/xdocs changes.xml index.xml navigation.xml
  Removed:     localization/xdocs index.xml navigation.xml changes.xml
  Log:
  Improving docs
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-fulcrum/localization/impl/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
    <properties>
      <title>Fulcrum Localization</title>
      <author email="epugh@upstate.com">Eric Pugh</author>
    </properties>
  
    <body>
      <release version="1.0-alpha-4" date="">
        <action dev="epugh" type="add">
  		Merlinized code with input from Stephen
        </action>
      </release>  	
      <release version="1.0-alpha-3" date="">
        <action dev="epugh" type="add">
          New Localization class that is a facade to the underlying service.
        </action>
      </release>
  
    </body>
  </document>
  
  
  
  
  1.1                  jakarta-turbine-fulcrum/localization/impl/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <document>
  
    <properties>
      <title>Localization Component</title>
      <author email="epugh@upstate.com">Eric PUgh</author>
    </properties>
  
    <body>
  
    <section name="Overview">
      <p>
        This component wraps provides Localization of strings.  It is written 
        for use in Turbine but it can be used in any container compatible 
        with Avalon's ECM container.
      </p>    
    </section>
    
  <section name="Configuration">
  
      <p>
        First, here is the role configuration.
      </p>
  
  <source>
  <![CDATA[
      <role
          name="org.apache.fulcrum.localization.LocalizationService"
          shorthand="localization"
          default-class="org.apache.fulcrum.localization.DefaultLocalizationService"/>
  ]]>
  </source>
  
    <p>
      Now comes the basic configuration of the component.  Here will will
      configure the various bundles.
    </p>
  <source>
  
  <![CDATA[
      <localization>
        <bundles>
          <bundle>org.apache.fulcrum.localization.BarBundle</bundle>
          <bundle>org.apache.fulcrum.localization.FooBundle</bundle>
        </bundles>
      </localization>
  ]]>
  </source>
  
    </section>
  
    <section name="Usage">
  
  <source><![CDATA[
  
  TurbineServices.getInstance().getService(LocalizationService.LOCALIZATION)
      .getString("DISPLAYPROJECTS_TITLE");
  
  ]]></source>
  
  <p>
  Wow. That is a lot of typing. That could be easily shortened to this:
  </p>
  
  <source><![CDATA[
  
  Localization.getString("DISPLAYPROJECTS_TITLE");
  
  ]]></source>
  
  <p>
  The hard example above was given as an example of using Services. The easy
  example is the one that you really should be using. Another cool feature
  of the Localization class is that you can pass in a RunData object like
  this:
  </p>
  
  <source><![CDATA[
  
  Localization.getString(data, "DISPLAYPROJECTS_TITLE");
  
  ]]></source>
  
  <p>
  This has the added effect of using the Accept-Language HTTP header to determine
  which language to display based on what setting the user has defined in
  the browser. Can you say Dynamic Localization? ;-)
  </p>
  
  <p>
  For creating the file where you get the value of the String, please
  see the <em>java.util.ListResourceBundle</em> and
  <em>java.util.ResourceBundle</em> classes for more information.
  <a href="http://java.apache.org/jyve/">Jyve</a> also contains example usage
  of this code because that was the first place where this code was originally
  developed.
  </p>
    </section>  
  
  </body>
  </document>
  
  
  
  1.1                  jakarta-turbine-fulcrum/localization/impl/xdocs/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <project
    name="localization"
    href="http://jakarta.apache.org/turbine/fulcrum/localization/">
  
    <body>
      <links>
        <item name="Turbine"
              href="http://jakarta.apache.org/turbine/"/>
        <item name="Fulcrum"
              href="http://jakarta.apache.org/turbine/fulcrum/"/>
      </links>
  
      <menu name="Overview">
        <item name="Main"                 href="/index.html"/>
      </menu>
    </body>
  </project>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org