mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
CIRCA Multilingual changes (Philippe Dubois)
- Web Client support for changing content filter language - I18NUtil support for contentLocale - MLPropertyInterceptor handling of properties inbound and outbound TODO: - Is new Locale("") valid? - Some more tests to ensure property interceptor is working - Move interceptor into .sample config file git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5003 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,7 @@ package org.alfresco.web.app.servlet;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.portlet.PortletSession;
|
import javax.portlet.PortletSession;
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
@@ -154,12 +155,22 @@ public final class AuthenticationHelper
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
tx = null; // clear this so we know not to rollback
|
tx = null; // clear this so we know not to rollback
|
||||||
|
|
||||||
|
// // store the User object in the Session - the authentication servlet will then proceed
|
||||||
|
// session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user);
|
||||||
|
//
|
||||||
|
// // Set the current locale
|
||||||
|
// I18NUtil.setLocale(Application.getLanguage(httpRequest.getSession()));
|
||||||
|
//
|
||||||
|
// // remove the session invalidated flag
|
||||||
|
// session.removeAttribute(AuthenticationHelper.SESSION_INVALIDATED);
|
||||||
|
|
||||||
|
I18NUtil.setLocale(Application.getLanguage(httpRequest.getSession()));
|
||||||
// store the User object in the Session - the authentication servlet will then proceed
|
// store the User object in the Session - the authentication servlet will then proceed
|
||||||
session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user);
|
session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user);
|
||||||
|
|
||||||
// Set the current locale
|
// Set the current locale
|
||||||
I18NUtil.setLocale(Application.getLanguage(httpRequest.getSession()));
|
I18NUtil.setLocale(Application.getLanguage(httpRequest.getSession()));
|
||||||
|
//
|
||||||
// remove the session invalidated flag
|
// remove the session invalidated flag
|
||||||
session.removeAttribute(AuthenticationHelper.SESSION_INVALIDATED);
|
session.removeAttribute(AuthenticationHelper.SESSION_INVALIDATED);
|
||||||
|
|
||||||
@@ -217,6 +228,19 @@ public final class AuthenticationHelper
|
|||||||
// Set the current locale
|
// Set the current locale
|
||||||
I18NUtil.setLocale(Application.getLanguage(httpRequest.getSession()));
|
I18NUtil.setLocale(Application.getLanguage(httpRequest.getSession()));
|
||||||
|
|
||||||
|
/* setup face context */
|
||||||
|
FacesHelper.getFacesContext(httpRequest, httpResponse, context);
|
||||||
|
|
||||||
|
if (loginBean != null && (loginBean.getUserPreferencesBean() != null) )
|
||||||
|
{
|
||||||
|
String contentFilterLanguageStr = loginBean.getUserPreferencesBean().getContentFilterLanguage();
|
||||||
|
if (contentFilterLanguageStr != null)
|
||||||
|
{
|
||||||
|
//set the cocale for the method interceptor for MLText properties
|
||||||
|
I18NUtil.setContentLocale(new Locale(contentFilterLanguageStr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return AuthenticationStatus.Success;
|
return AuthenticationStatus.Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -101,6 +101,11 @@ public class LoginBean
|
|||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserPreferencesBean getUserPreferencesBean()
|
||||||
|
{
|
||||||
|
return preferences;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the default Alfresco authentication process is being used, else false
|
* @return true if the default Alfresco authentication process is being used, else false
|
||||||
* if an external authorisation mechanism is present.
|
* if an external authorisation mechanism is present.
|
||||||
|
@@ -28,6 +28,7 @@ import org.alfresco.config.Config;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.i18n.I18NUtil;
|
import org.alfresco.i18n.I18NUtil;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
|
import org.alfresco.web.app.context.UIContextService;
|
||||||
import org.alfresco.web.app.servlet.FacesHelper;
|
import org.alfresco.web.app.servlet.FacesHelper;
|
||||||
import org.alfresco.web.bean.repository.PreferencesService;
|
import org.alfresco.web.bean.repository.PreferencesService;
|
||||||
import org.alfresco.web.config.LanguagesConfigElement;
|
import org.alfresco.web.config.LanguagesConfigElement;
|
||||||
@@ -135,6 +136,9 @@ public class UserPreferencesBean
|
|||||||
language = I18NUtil.parseLocale(languageStr);
|
language = I18NUtil.parseLocale(languageStr);
|
||||||
}
|
}
|
||||||
PreferencesService.getPreferences().setValue(PREF_CONTENTFILTERLANGUAGE, language);
|
PreferencesService.getPreferences().setValue(PREF_CONTENTFILTERLANGUAGE, language);
|
||||||
|
|
||||||
|
// Ensure a refresh
|
||||||
|
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user