[
https://jira.jboss.org/browse/GTNPORTAL-1306?page=com.atlassian.jira.plug...
]
Marko Strukelj commented on GTNPORTAL-1306:
-------------------------------------------
Looking closer into this issue revealed the need for a slight overhaul of how Locale is
determined for the portal requests. The suggested patch is essentially correct, except
that Locale will be moved from UIPortalApplication to PortalRequestContext, and additional
Locale pluggability layer added so implementors can add custom policies for determining
the locale.
This work is in progress and should make it in trunk within weeks.
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.0.0-GA, 3.1.0-CR01
Reporter: Leng Chye Ooi
Assignee: Marko Strukelj
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