Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

This is one in a series on new features in the latest portal releases -- 2004 SP Stack 20 and 7.0 (formerly 2004s) SP Stack 12. The features were listed in the blog What's New in the Portal for 2004 SP20 / 7.0 SP12.

A very big request from customers was to easily allow anonymous users to change the language of the portal. Up until now, you had to have some sort of work around, like creating named anonymous users for each language you wanted to expose and provide links that specified a different anonymous user for each language.

In the latest release, you barely have to do anything. The masthead, when accessed by an anonymous user, now can include a dropdown list of languages so that the user can pick his language.
 

image
The anonymous user can pick a language, and the portal's language immediately changes.

image

How to Set It Up

It's easy to add the dropdown list, just set the Show Dropdown List in Masthead: Language Personalization for Anonymous Users property of the masthead iView to Yes (yes, that's one long property name).

image

image

Modifying the Masthead

A common layout for websites is to show a set of flags for changing the language. You can customize the masthead, and use a simple API to change the language. Modify the UI, and then when you need to set the language, use the following code:

HttpSession session = request.getServletRequest().getSession(); session.setAttribute("sessionLocale", newLocale); newLocale is a string that equals the locale code.
7 Comments