Saturday, September 11, 2010

Tag to change locale from links on IBM WPS 6.0 Theme

Recently we had a requirement to enable portlet application to support multilingual. Initially we were supporting English language (en_US) but the new requirement was to have Spanish (es) support.

The requirement was when user visits the portlet application he should be able to toggle between English and Spanish. At a time only one of the links needs to displayed. The best place to put this link was on Theme level in banner.jspf.

I just wanted to share with you all the useful tag to switch the portal locale at a global level.
 
<portal-navigation:url command="ChangeLanguage">
 
This tag is used to change the active language in the navigational state in which the URL is generated.
The following code example uses this tag to change the language to Spanish:
 
<a href='<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale" value="es"/></portal-navigation:url>'>En Espanol</a>

3 comments:

  1. How can we change language when going to a friendly url like this.
    a href="/wps/portal/Login"

    how can i call command="ChangeLanguage" in this situation?
    Could you help me please?

    ReplyDelete
  2. As I mentioned earlier, the best place to put this link was on Theme level in banner.jspf. Now to call the command you have to have a link somewhere on your login page which the user clicks and the command will be called. What issue are you exactly facing? I can help you with it.

    ReplyDelete
  3. Thanks for the info.
    But I was wondering If you can help in the following.
    I'm facing a problem when using a URL to a jsp.
    How can I keep the locale in this url:
    "http://172.16.60.89:10039/wps/omnifind/portalSearchBar.jsp"?

    ReplyDelete