Saturday, 8 November 2014

Dynamically changing language in websphere portal

Use-case :- There will be a common scenario where client asks you to change language dynamically from drop-down. Think drop-down contains English/Spanish how do you accomplish this task.

Portal tag :- This tag will generate the language specific url based on the urlParam passed to it. where language is the two character code for the required language, such as en, de, or fr. For a list of the available languages and their two character codes read Language support.

<portal-navigation:url command="ChangeLanguage">
   <portal-navigation:urlParam name="locale" value="language"/>
</portal-navigation:url>

Step 1 :-
For users to be able to dynamically change the language for the session, add a link to the portal theme with the following text and link reference:
The text displayed with the link specifies the language to which the user can change.
The link reference calls the command described previously with the locale parameter corresponding to the specified language.

Step 2 :-
Users can then click this link to change to the language specified by the locale parameter with the command attribute.

Example: - To create links for English andSpanish, add the lines shown in the following example to your theme

<a href="<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale"
     value="en"/></portal-navigation:url>">English</a>
<a href="<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale"
     value="es"/></portal-navigation:url>">Spanish</a>


2 comments:

Custom single threaded java server

 package com.diffengine.csv; import java.io.*; import java.net.*; import java.util.Date; public class Server { public static void main(Str...