oalexeev 01/11/21 10:48:42 Modified: src/share/org/apache/struts/util RequestUtils.java Log: Add method retrieveUserLocale(PageContext pageContext, String localeKey) Revision Changes Path 1.25 +21 -10 jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java Index: RequestUtils.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- RequestUtils.java 2001/11/21 14:00:28 1.24 +++ RequestUtils.java 2001/11/21 18:48:42 1.25 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v 1.24 2001/11/21 14:00:28 husted Exp $ - * $Revision: 1.24 $ - * $Date: 2001/11/21 14:00:28 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v 1.25 2001/11/21 18:48:42 oalexeev Exp $ + * $Revision: 1.25 $ + * $Date: 2001/11/21 18:48:42 $ * * ==================================================================== * @@ -102,7 +102,7 @@ * * @author Craig R. McClanahan * @author Ted Husted - * @version $Revision: 1.24 $ $Date: 2001/11/21 14:00:28 $ + * @version $Revision: 1.25 $ $Date: 2001/11/21 18:48:42 $ */ public class RequestUtils { @@ -529,6 +529,22 @@ /** + * Look up and return current user locale, based on the specified parameters. + * + * @param pageContext The PageContext associated with this request + * @param locale Name of the session attribute for our user's Locale + */ + public static Locale retrieveUserLocale( PageContext pageContext, String locale ) { + if (locale == null) + locale = Action.LOCALE_KEY; + Locale userLocale = (Locale) + pageContext.getAttribute(locale, PageContext.SESSION_SCOPE); + if (userLocale == null) + userLocale = defaultLocale; + return userLocale; + } + + /** * Look up and return a message string, based on the specified parameters. * * @param pageContext The PageContext associated with this request @@ -579,12 +595,7 @@ } // Look up the requested Locale - if (locale == null) - locale = Action.LOCALE_KEY; - Locale userLocale = (Locale) - pageContext.getAttribute(locale, PageContext.SESSION_SCOPE); - if (userLocale == null) - userLocale = defaultLocale; + Locale userLocale = retrieveUserLocale( pageContext, locale ); // Return the requested message if (args == null)
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>