|
Home > Archive > WebSphere Portal Server > June 2007 > How to setLocale() in portlet to dynamically switch language
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to setLocale() in portlet to dynamically switch language
|
|
|
|
Hi,
I am using portal 5.1.
In portlet, when I get the 'lang' param from the page url, e.g. "en" or "fr", I need somehow setLocale() to be able to dynamically switch language.
I know in regular JSF Web application, kind of call
public void setLocale(String locale)
{
FacesContext.getCurrentInstance().getViewRoot().setLocale(new Locale(locale));
}
However, it looks in portlet, this method does not work.
Any idea?
Thanks very much in advance!
| |
| yurykats 2007-06-04, 1:20 am |
| The code you pasted should also work in a portlet. It should change the locale if the JSF view, ie the content of the portlet. It won't have any affect on anything outside the portlet, such as the portlet's title bar and the rest of the Portal markup.
Also, make sure the locale you're trying to set is declared in faces-config as "supported", otherwise JSF won't use it even if you called setLocale.
|
|
|
|
|