XPages: change language dynamically on XPage

Using

http://myserver/foo.nsf/main.xsp?OpenXPage&par1=bar&par2=baz on a URL I pass parameters to my XPage including language

In response to this I try and change computed Text labels from one language to another. I am using this to get the parameter

context.getUrlParameter(“par2”)

However if then seems to fail when I do the normal JS

probabyl something really simle- what am I doing wrong

var lang = context.getUrlParameter(“lang”);

If(lang==“en”)

{

return "English text:";

}else{

return "Other language text:";

}

Subject: Still does not work

Tried to put the parameter in a field on the XPage and then drew it from there for each dynamic text label with

document.getItemValueString(“Lang”);

if(s = “en”) {

return "english:"

} else {

	return "foreign: ";

}

I will always get the first value but not the second. It seems s is blank in practice

So I tried calling the parameter directly

return context.getUrlParameter(“lang”); which brough back the parameter

then I tried making a variable out of it and it all went to pot again

var s = context.getUrlParameter(“lang”);

return s

no value was returned for s

How can I get value s in a useable format for the rest of my script

Subject: Works now

Used this to solve problem set lang as first field on the form I bound to

Then computed text labels using computed fields and this formula

var s = context.getUrlParameter(“lang”);

if(s == “en”) {

return "english	 

} else {

return "foreign";

}