Skip to Content
0
Former Member
May 10, 2010 at 07:55 PM

Setting User Locale by adding links in Masthead iview

23 Views

Hi Guys,

Our client wants portal to be bilingual, English and French. These links has to toggle when pressed. If the current users language is English then French link should appear and onclick of the link it has to set the user locale to French and the link to English. We placed the links in Masthead iview by editing it. The code that puts the links in Masthead and sets the locale are given below. All these functions and code are placed in HeaderiView.jsp

The issue we are facing is when ever a user logs in, the Language Link will be based on his default locale. On page refresh the locale gets changed to French if the order of Javascript function is setEnglish and setFrench, irrespective of the link pressed. But if I change the order of Javascript functions to setFrench and then setEnglish, then on refresh the local of the user gets changed to English.

We are using portal UME. All suggestions are welcome.

<%boolean isFrenchLocale=isFrench(componentRequest);
if(isFrenchLocale)
{ %>
<TD nowrap id="English" name="EnglishName" style="display: inline">
<%} else {%>
<TD nowrap id="English" name="EnglishName" style="display: none">
<% }%>								
<hbj:link id="EnglishLink" linkDesign="FUNCTION" reference="#" text="English" >
<% { EnglishLink.setOnClientClick("javascript:setEnglish();");} %>
</hbj:link>
</TD>
<%if (isFrenchLocale){%>
<TD id="French" name="FrenchName" style="display: none">
<%} else {%>
<TD id="French" name="FrenchName" style="display: inline">
<% }%>
<hbj:link id="FrenchLink" linkDesign="FUNCTION" reference="#" text="Français">
<% { FrenchLink.setOnClientClick("javascript:setFrench();");} %>
</hbj:link>
</TD>

The Java script functions are

function setEnglish()
{
<%setCurrentLocale(componentRequest,"EN");%>
window.top.location.href="/irj/portal";
}
function setFrench()
{
<%setCurrentLocale(componentRequest,"FR");%>
window.top.location.href="/irj/portal";
}