dlr         01/09/25 18:47:17

  Modified:    src/tool/org/apache/turbine/tool LocalizationTool.java
  Log:
  Now pulling information from RunData/HttpServletRequest to hold onto
  only that which is relevant.
  
  Revision  Changes    Path
  1.6       +10 -8     
jakarta-turbine-3/src/tool/org/apache/turbine/tool/LocalizationTool.java
  
  Index: LocalizationTool.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-3/src/tool/org/apache/turbine/tool/LocalizationTool.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- LocalizationTool.java     2001/09/20 23:38:28     1.5
  +++ LocalizationTool.java     2001/09/26 01:47:17     1.6
  @@ -54,9 +54,9 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.Locale;
   import java.util.MissingResourceException;
   import java.util.ResourceBundle;
  -import javax.servlet.http.HttpServletRequest;
   
   import org.apache.fulcrum.localization.Localization;
   
  @@ -73,10 +73,10 @@
   public class LocalizationTool implements ApplicationTool
   {
       /**
  -     * The request to get the <code>Accept-Language</code> header
  -     * from.  Reset on each request.
  +     * The language and country information parsed from the request's
  +     * <code>Accept-Language</code> header.  Reset on each request.
        */
  -    private HttpServletRequest req;
  +    protected Locale locale;
   
       /**
        * The bundle for this request.
  @@ -114,7 +114,7 @@
           if (bundle == null)
           {
               // Cache bundle for use during current request.
  -            bundle = Localization.getBundle(bundleName, req);
  +            bundle = Localization.getBundle(bundleName, locale);
           }
   
           try
  @@ -146,13 +146,15 @@
   
       /**
        * Sets the request to get the <code>Accept-Language</code> header
  -     * from.
  +     * from (reset on each request).
        */
       public final void init(Object data)
       {
           if (data instanceof RunData)
           {
  -            this.req = ((RunData) data).getRequest();
  +            // Pull necessary information out of RunData while we have
  +            // a reference to it.
  +            locale = Localization.getLocale( ((RunData) data).getRequest() );
               bundleName = getBundleName(data);
           }
       }
  @@ -162,7 +164,7 @@
        */
       public void refresh()
       {
  -        req = null;
  +        locale = null;
           bundle = null;
           bundleName = null;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to