From 13db776f4edba97939faaaa6fc0174c106d54866 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Wed, 12 Feb 2014 14:40:02 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud) 60831: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3) 60750: Merged DEV to V4.2-BUG-FIX (4.2.1) 60659: MNT-10145: JSF: Inconsistent browser behaviour when setting to false - Some jsp pages were updated to set locale for the current user context. Also, getLanguage() methods were modified to take into account useInterfaceLanguage flag. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62367 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- source/java/org/alfresco/web/app/Application.java | 9 +++++---- source/web/jsp/browse/browse.jsp | 8 +++++++- source/web/jsp/dashboards/container.jsp | 8 +++++++- source/web/jsp/dialog/container.jsp | 15 ++++++++++++++- source/web/jsp/login.jsp | 7 ++++++- 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/source/java/org/alfresco/web/app/Application.java b/source/java/org/alfresco/web/app/Application.java index ac0d76656e..aa6129d3f7 100644 --- a/source/java/org/alfresco/web/app/Application.java +++ b/source/java/org/alfresco/web/app/Application.java @@ -759,6 +759,7 @@ public class Application */ public static Locale getLanguage(FacesContext fc) { + boolean useInterfaceLanguage = Application.getClientConfig(fc).isLanguageSelect(); Map sessionMap = fc.getExternalContext().getSessionMap(); Boolean useSessionLocale = (Boolean)sessionMap.get(USE_SESSION_LOCALE); if (useSessionLocale == null) @@ -767,9 +768,9 @@ public class Application sessionMap.put(USE_SESSION_LOCALE, useSessionLocale); } Locale locale = (Locale)sessionMap.get(LOCALE); - if (locale == null) + if (locale == null || (!locale.equals(I18NUtil.getLocale()) && !useInterfaceLanguage)) { - if (useSessionLocale) + if (useSessionLocale && useInterfaceLanguage) { // first check saved user preferences String strLocale = null; @@ -834,9 +835,9 @@ public class Application session.setAttribute(USE_SESSION_LOCALE, useSessionLocale); } Locale locale = (Locale)session.getAttribute(LOCALE); - if (locale == null) + if (locale == null || (!locale.equals(I18NUtil.getLocale()) && !useInterfaceLanguage)) { - if (useSessionLocale) + if (useSessionLocale && useInterfaceLanguage) { // first check saved user preferences String strLocale = null; diff --git a/source/web/jsp/browse/browse.jsp b/source/web/jsp/browse/browse.jsp index c8f73def6c..cffb647ee3 100644 --- a/source/web/jsp/browse/browse.jsp +++ b/source/web/jsp/browse/browse.jsp @@ -19,6 +19,7 @@ <%@ page import="org.alfresco.web.app.Application" %> <%@ page import="javax.faces.context.FacesContext" %> +<%@ page import="java.util.Locale" %> <%@ page import="org.alfresco.web.ui.common.PanelGenerator"%> @@ -64,7 +65,12 @@ FacesContext fc = FacesContext.getCurrentInstance(); // set locale for JSF framework usage - fc.getViewRoot().setLocale(Application.getLanguage(fc)); + Locale locale = Application.getLanguage(fc); + fc.getViewRoot().setLocale(locale); + if (!Application.getClientConfig(fc).isLanguageSelect()) + { + Application.setLanguage(fc, locale.toString()); + } %> <%-- load a bundle of properties with I18N strings --%> diff --git a/source/web/jsp/dashboards/container.jsp b/source/web/jsp/dashboards/container.jsp index 39c37a6fe2..021736371e 100644 --- a/source/web/jsp/dashboards/container.jsp +++ b/source/web/jsp/dashboards/container.jsp @@ -27,6 +27,7 @@ <%@ page import="org.alfresco.web.app.Application" %> <%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> <%@ page import="javax.faces.context.FacesContext" %> +<%@ page import="java.util.Locale" %> @@ -35,7 +36,12 @@ FacesContext fc = FacesContext.getCurrentInstance(); // set locale for JSF framework usage - fc.getViewRoot().setLocale(Application.getLanguage(fc)); + Locale locale = Application.getLanguage(fc); + fc.getViewRoot().setLocale(locale); + if (!Application.getClientConfig(fc).isLanguageSelect()) + { + Application.setLanguage(fc, locale.toString()); + } %> <%-- load a bundle of properties with I18N strings --%> diff --git a/source/web/jsp/dialog/container.jsp b/source/web/jsp/dialog/container.jsp index f53a1b6e98..488cb4734e 100644 --- a/source/web/jsp/dialog/container.jsp +++ b/source/web/jsp/dialog/container.jsp @@ -26,6 +26,8 @@ <%@ page isELIgnored="false" %> <%@ page import="org.alfresco.web.app.Application" %> <%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> +<%@ page import="javax.faces.context.FacesContext" %> +<%@ page import="java.util.Locale" %> <% if (Application.getDialogManager().getState() == null) @@ -38,7 +40,18 @@ if (Application.getDialogManager().getState() == null) - + <% + FacesContext fc = FacesContext.getCurrentInstance(); + + // set locale for JSF framework usage + Locale locale = Application.getLanguage(fc); + fc.getViewRoot().setLocale(locale); + if (!Application.getClientConfig(fc).isLanguageSelect()) + { + Application.setLanguage(fc, locale.toString()); + } + %> + <%-- load a bundle of properties with I18N strings --%> diff --git a/source/web/jsp/login.jsp b/source/web/jsp/login.jsp index 4c3b92723c..ac8c370525 100644 --- a/source/web/jsp/login.jsp +++ b/source/web/jsp/login.jsp @@ -69,7 +69,12 @@ FacesContext fc = FacesContext.getCurrentInstance(); // set locale for JSF framework usage (passed on by Localization Filter) - fc.getViewRoot().setLocale(I18NUtil.getLocale()); + Locale locale = I18NUtil.getLocale(); + fc.getViewRoot().setLocale(locale); + if (!Application.getClientConfig(fc).isLanguageSelect()) + { + Application.setLanguage(fc, locale.toString()); + } // set permissions error if applicable if (session.getAttribute(LoginBean.LOGIN_NOPERMISSIONS) != null)