| Author |
Portlet Localization for anonymous user
|
|
|
| Portlet jsp pages can be localized by using jstl format tag with resource bundles. However the language preference is set by using portal's 'edit my preferences' dialog.
How can user locale or language choice be changed for anonymous users of portal?
| |
|
| For anonymous users it's picked up from request header set by the browser. For IE see Internet options->Languages...
| |
|
| True, but I need to control among a few locales the app supports. Can I ask user to select a language and then let portal treat it like it does when a registered user sets language preference?
I've noticed that the portal inserts a locale obj in request when a user sets language. Is there a way to mimic it?
Thanks,
| |
| Dev Anand Reddy 2007-01-30, 7:30 am |
| Websphere Portal Server supports the following command which you may insert in your theme or somewhere in the jsp.
<wps:url command="ChangeLanguage"><wps:urlParam name="locale" value="fr"/></wps:url>
<wps:url command="ChangeLanguage"><wps:urlParam name="locale"
value="fr_CH"/></wps:url>
Put the above command in anchor tag of html.
When user clicks on above provided links, the entire locale of the portal server will be changed.
You can query the locale simply by calling PortletRequest objects getLocale() method. Or if you want to get simply the user locale try to get 'accept-language' header from request.
|
|
|
|