PortletRequest's locale to return user's preference language instead of the locale
from Accept-Language header
--------------------------------------------------------------------------------------------------------------
Key: GTNPORTAL-1306
URL:
https://jira.jboss.org/browse/GTNPORTAL-1306
Project: GateIn Portal
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Internationalization and Localization
Affects Versions: 3.1.0-CR01, 3.0.0-GA
Reporter: Leng Chye Ooi
As per reported in the discussion forum (
https://community.jboss.org/thread/152834 ),
PortletRequest.getLocale() is returning the locale value based on the HTTP Accept-Language
header. My expectation, and I guess most users too, would expect the Change Language
action on the portal should also reflected in all the portlets that support
internationalization.
With a rough experiment, I am able to get the above expected scenario to work if I replace
the org.exoplatform.portal.webui.application.ExoUserContext.getLocale() method above with
public Locale getLocale() {
PortalRequestContext context = PortalRequestContext.getCurrentInstance();
if(context != null) {
UIPortalApplication uiPortalApplication = (UIPortalApplication)
context.getUIApplication();
Locale locale = uiPortalApplication.getLocale();
if (locale != null) return locale;
}
return clientRequest != null ? clientRequest.getLocale()
: Locale.ENGLISH;
}
Please advise if this is the correct approach. I am willing to submit a patch for this if
need to.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira