mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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 <language-select> 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
This commit is contained in:
@@ -759,6 +759,7 @@ public class Application
|
|||||||
*/
|
*/
|
||||||
public static Locale getLanguage(FacesContext fc)
|
public static Locale getLanguage(FacesContext fc)
|
||||||
{
|
{
|
||||||
|
boolean useInterfaceLanguage = Application.getClientConfig(fc).isLanguageSelect();
|
||||||
Map sessionMap = fc.getExternalContext().getSessionMap();
|
Map sessionMap = fc.getExternalContext().getSessionMap();
|
||||||
Boolean useSessionLocale = (Boolean)sessionMap.get(USE_SESSION_LOCALE);
|
Boolean useSessionLocale = (Boolean)sessionMap.get(USE_SESSION_LOCALE);
|
||||||
if (useSessionLocale == null)
|
if (useSessionLocale == null)
|
||||||
@@ -767,9 +768,9 @@ public class Application
|
|||||||
sessionMap.put(USE_SESSION_LOCALE, useSessionLocale);
|
sessionMap.put(USE_SESSION_LOCALE, useSessionLocale);
|
||||||
}
|
}
|
||||||
Locale locale = (Locale)sessionMap.get(LOCALE);
|
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
|
// first check saved user preferences
|
||||||
String strLocale = null;
|
String strLocale = null;
|
||||||
@@ -834,9 +835,9 @@ public class Application
|
|||||||
session.setAttribute(USE_SESSION_LOCALE, useSessionLocale);
|
session.setAttribute(USE_SESSION_LOCALE, useSessionLocale);
|
||||||
}
|
}
|
||||||
Locale locale = (Locale)session.getAttribute(LOCALE);
|
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
|
// first check saved user preferences
|
||||||
String strLocale = null;
|
String strLocale = null;
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
<%@ page import="org.alfresco.web.app.Application" %>
|
<%@ page import="org.alfresco.web.app.Application" %>
|
||||||
<%@ page import="javax.faces.context.FacesContext" %>
|
<%@ page import="javax.faces.context.FacesContext" %>
|
||||||
|
<%@ page import="java.util.Locale" %>
|
||||||
|
|
||||||
<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%>
|
<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%>
|
||||||
|
|
||||||
@@ -64,7 +65,12 @@
|
|||||||
FacesContext fc = FacesContext.getCurrentInstance();
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
|
||||||
// set locale for JSF framework usage
|
// 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 --%>
|
<%-- load a bundle of properties with I18N strings --%>
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
<%@ page import="org.alfresco.web.app.Application" %>
|
<%@ page import="org.alfresco.web.app.Application" %>
|
||||||
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
|
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
|
||||||
<%@ page import="javax.faces.context.FacesContext" %>
|
<%@ page import="javax.faces.context.FacesContext" %>
|
||||||
|
<%@ page import="java.util.Locale" %>
|
||||||
|
|
||||||
<r:page titleId="title_my_alfresco">
|
<r:page titleId="title_my_alfresco">
|
||||||
|
|
||||||
@@ -35,7 +36,12 @@
|
|||||||
FacesContext fc = FacesContext.getCurrentInstance();
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
|
||||||
// set locale for JSF framework usage
|
// 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 --%>
|
<%-- load a bundle of properties with I18N strings --%>
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
<%@ page isELIgnored="false" %>
|
<%@ page isELIgnored="false" %>
|
||||||
<%@ page import="org.alfresco.web.app.Application" %>
|
<%@ page import="org.alfresco.web.app.Application" %>
|
||||||
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
|
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
|
||||||
|
<%@ page import="javax.faces.context.FacesContext" %>
|
||||||
|
<%@ page import="java.util.Locale" %>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
if (Application.getDialogManager().getState() == null)
|
if (Application.getDialogManager().getState() == null)
|
||||||
@@ -38,6 +40,17 @@ if (Application.getDialogManager().getState() == null)
|
|||||||
<r:page title="<%=Application.getDialogManager().getTitle() %>">
|
<r:page title="<%=Application.getDialogManager().getTitle() %>">
|
||||||
|
|
||||||
<f:view>
|
<f:view>
|
||||||
|
<%
|
||||||
|
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 --%>
|
<%-- load a bundle of properties with I18N strings --%>
|
||||||
<r:loadBundle var="msg"/>
|
<r:loadBundle var="msg"/>
|
||||||
|
@@ -69,7 +69,12 @@
|
|||||||
FacesContext fc = FacesContext.getCurrentInstance();
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
|
||||||
// set locale for JSF framework usage (passed on by Localization Filter)
|
// 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
|
// set permissions error if applicable
|
||||||
if (session.getAttribute(LoginBean.LOGIN_NOPERMISSIONS) != null)
|
if (session.getAttribute(LoginBean.LOGIN_NOPERMISSIONS) != null)
|
||||||
|
Reference in New Issue
Block a user