dgraham     2003/08/23 10:27:24

  Modified:    src/share/org/apache/struts/config
                        ConfigHelperInterface.java ConfigHelper.java
  Log:
  Removed getLocale() because it duplicated logic from RequestUtils.getUserLocale().
  
  Revision  Changes    Path
  1.8       +4 -16     
jakarta-struts/src/share/org/apache/struts/config/ConfigHelperInterface.java
  
  Index: ConfigHelperInterface.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ConfigHelperInterface.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ConfigHelperInterface.java        8 Aug 2003 23:26:36 -0000       1.7
  +++ ConfigHelperInterface.java        23 Aug 2003 17:27:24 -0000      1.8
  @@ -64,7 +64,6 @@
   
   
   import java.util.Iterator;
  -import java.util.Locale;
   
   import javax.sql.DataSource;
   
  @@ -133,17 +132,6 @@
   
   
   // ---------------------------------------------------- Session Context
  -
  -
  -    /**
  -     * The <code>java.util.Locale</code> for the user, if any.
  -     * If a default locale object is not in the user's session,
  -     * the system default locale is returned.
  -     * If used, the user locale is typically set during login
  -     * processing under the key <code>Globals.LOCALE_KEY</code>.
  -     */
  -    public Locale getLocale();
  -
   
       /**
        * The transaction token stored in this session, if it is used.
  
  
  
  1.11      +15 -30    
jakarta-struts/src/share/org/apache/struts/config/ConfigHelper.java
  
  Index: ConfigHelper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ConfigHelper.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ConfigHelper.java 16 Aug 2003 18:38:56 -0000      1.10
  +++ ConfigHelper.java 23 Aug 2003 17:27:24 -0000      1.11
  @@ -62,7 +62,6 @@
   package org.apache.struts.config;
   
   import java.util.Iterator;
  -import java.util.Locale;
   
   import javax.servlet.ServletContext;
   import javax.servlet.http.HttpServletRequest;
  @@ -80,6 +79,7 @@
   import org.apache.struts.action.ActionMessages;
   import org.apache.struts.upload.MultipartRequestWrapper;
   import org.apache.struts.util.MessageResources;
  +import org.apache.struts.util.RequestUtils;
   
   /**
    * NOTE: THIS CLASS IS UNDER ACTIVE DEVELOPMENT.
  @@ -256,27 +256,6 @@
       // ---------------------------------------------------- Session Context
   
       /**
  -     * The <code>java.util.Locale</code> for the user, if any.
  -     * If a default locale object is not in the user's session,
  -     * the system default locale is returned.
  -     * If used, the user locale is typically set during login
  -     * processing under the key <code>Globals.LOCALE_KEY</code>.
  -     */
  -    public Locale getLocale() {
  -        Locale locale = null;
  -
  -        if (session != null) {
  -            locale = (Locale) session.getAttribute(Globals.LOCALE_KEY);
  -        }
  -
  -        if ((locale == null) && (request != null)) {
  -            locale = request.getLocale();
  -        }
  -
  -        return locale;
  -    }
  -
  -    /**
        * The transaction token stored in this session, if it is used.
        */
       public String getToken() {
  @@ -359,7 +338,7 @@
           }
   
           // Return the requested message presence indicator
  -        return (resources.isPresent(getLocale(), key));
  +        return resources.isPresent(RequestUtils.getUserLocale(request, null), key);
   
       }
   
  @@ -600,7 +579,8 @@
           MessageResources resources = getMessageResources();
           if (resources == null)
               return null;
  -        return resources.getMessage(getLocale(), key);
  +
  +        return resources.getMessage(RequestUtils.getUserLocale(request, null), key);
   
       }
   
  @@ -619,9 +599,14 @@
   
           // Return the requested message
           if (args == null)
  -            return (resources.getMessage(getLocale(), key));
  +            return resources.getMessage(
  +                RequestUtils.getUserLocale(request, null),
  +                key);
           else
  -            return (resources.getMessage(getLocale(), key, args));
  +            return resources.getMessage(
  +                RequestUtils.getUserLocale(request, null),
  +                key,
  +                args);
   
       }
   
  
  
  

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

Reply via email to