kpiroumian 02/04/25 09:25:44 Modified: src/java/org/apache/cocoon/acting LocaleAction.java Log: Fixed locale attribute name setting. Revision Changes Path 1.8 +15 -15 xml-cocoon2/src/java/org/apache/cocoon/acting/LocaleAction.java Index: LocaleAction.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/acting/LocaleAction.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- LocaleAction.java 22 Feb 2002 06:59:26 -0000 1.7 +++ LocaleAction.java 25 Apr 2002 16:25:44 -0000 1.8 @@ -151,7 +151,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Marcus Crafter</a> * @author <a href="mailto:[EMAIL PROTECTED]">Konstantin Piroumian</a> * @author <a href="mailto:[EMAIL PROTECTED]">Lassi Immonen</a> - * @version CVS $Id: LocaleAction.java,v 1.7 2002/02/22 06:59:26 cziegeler Exp $ + * @version CVS $Id: LocaleAction.java,v 1.8 2002/04/25 16:25:44 kpiroumian Exp $ */ public class LocaleAction extends ComposerAction implements ThreadSafe, Configurable { @@ -279,7 +279,7 @@ ) throws Exception { // obtain locale information (note, Locale.get* do not return null) - String lc = getLocaleAttribute(objectModel); + String lc = getLocaleAttribute(objectModel, localeAttr); Locale locale = I18nUtils.parseLocale(lc); String l = locale.getLanguage(); String c = locale.getCountry(); @@ -337,20 +337,20 @@ * @return locale value * @throws Exception should some error occur */ - public static String getLocaleAttribute(Map objectModel) throws Exception { + public static String getLocaleAttribute(Map objectModel, String localeAttrName) throws Exception { String ret_val; // 1. Request CGI parameter 'locale' Request request = ObjectModelHelper.getRequest(objectModel); - if ((ret_val = request.getParameter(LOCALE)) != null) + if ((ret_val = request.getParameter(localeAttrName)) != null) return ret_val; // 2. Session attribute 'locale' Session session = request.getSession(false); if (session != null && - ((ret_val = (String) session.getAttribute(LOCALE)) != null) + ((ret_val = (String) session.getAttribute(localeAttrName)) != null) ) return ret_val; @@ -360,7 +360,7 @@ if (cookies != null) { for (int i = 0; i < cookies.length; ++i) { Cookie cookie = cookies[i]; - if (cookie.getName().equals(LOCALE)) + if (cookie.getName().equals(localeAttrName)) return cookie.getValue(); } } @@ -393,15 +393,15 @@ createSession = par.getParameterAsBoolean(CREATE_SESSION, createSession); storeInCookie = par.getParameterAsBoolean(STORE_COOKIE, storeInCookie); - debug("checking for local overrides, " + - LANG_ATTR + " = " + langAttr + ", " + - COUNTRY_ATTR + " = " + countryAttr + ", " + - VARIANT_ATTR + " = " + variantAttr + ", " + - LOCALE_ATTR + " = " + localeAttr + ", " + - STORE_REQUEST + " = " + storeInRequest + ", " + - STORE_SESSION + " = " + storeInSession + ", " + - CREATE_SESSION + " = " + createSession + ", " + - STORE_COOKIE + " = " + storeInCookie + debug("checking for local overrides:\n" + + " " + LANG_ATTR + " = " + langAttr + ",\n" + + " " + COUNTRY_ATTR + " = " + countryAttr + ",\n" + + " " + VARIANT_ATTR + " = " + variantAttr + ",\n" + + " " + LOCALE_ATTR + " = " + localeAttr + ",\n" + + " " + STORE_REQUEST + " = " + storeInRequest + ",\n" + + " " + STORE_SESSION + " = " + storeInSession + ",\n" + + " " + CREATE_SESSION + " = " + createSession + ",\n" + + " " + STORE_COOKIE + " = " + storeInCookie + "\n" ); }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]