Hints and Tips for Creating Custom Portlets |
In a portlet initializer or action class, you can obtain the user's locale from the user context. For information about obtaining the user context, see Obtaining a User and Session Context.
The following code obtains the SAS profile from the user context and then obtains the locale from the instance of the SASProfileInterface:
ProfileInterface profile = userContext.getProfile(); SASProfileInterface sasProfile = (com.sas.preferences.SASProfileInterface)profile.getProfile("SAS"); Locale locale = sasProfile.getLocale();
Note: The locale is null if no value was available from the SAS profile. In this case, use the HttpServletRequest.getLocale() method instead.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.