2.8. Pluggable locale policy

2.8.1. LocalePolicy API
2.8.2. Default LocalePolicy
2.8.3. Custom LocalePolicy
2.8.4. LocalePolicy Configuration
2.8.5. Keeping non-bridged resources in synchronization with current Locale

Every request processed by every portlet is invoked within a context of current Locale. The current Locale can be retrieved by calling the getLocale() method of the javax.portlet.PortletRequest interface.

The exact algorithm for determining the current Locale is not specified by Portlet Specification, and is left to portlet containers to implement the way they deem the most appropriate.

In GateIn 3.5, each portal instance has a default language which can be used to present content for new users. Another option is to use each user's browser language preference, provided it matches one of the available localizations that GateIn 3.5 supports, and only fallback to portal default language if no match is found. Every user, while visiting a portal, has an option to change the language of the user interface by using a Language chooser. The choice can be remembered for the duration of the session, or it can be remembered for a longer period using a browser cookie, or for registered and logged-in users - it can be saved into user's profile.

So, you can see that there is more than one way to determine the Locale to be used for displaying a portal page to the user. For this reason, the mechanism for determining the current Locale of the request is pluggable in GateIn 3.5, so the exact algorithm can be customized.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus