Hi Bhavik,
FYI
I have used your script sparely, but successfully for some time now,
thank you for sharing.
I recently discovered it broke my recenlty added history support. That
is when I extended your script to support history tokens. Now it also
supports history tokens.
var currLocation = $wnd.location.toString();
var noHistoryCurrLocArray =
currLocation.split("#");
var noHistoryCurrLoc =
noHistoryCurrLocArray[0];
var historyToken = noHistoryCurrLocArray
[1];
var locArray=noHistoryCurrLoc.split("?");
var newHref = locArray[0]+"?
locale="+newLocale;
// alert('currLocation'+currLocation);
// alert
('noHistoryCurrLocArray'+noHistoryCurrLocArray);
// alert
('noHistoryCurrLoc'+noHistoryCurrLoc);
// alert('historyToken'+historyToken);
// alert('locArray'+locArray);
// alert('newHref'+newHref);
$wnd.location.href=newHref
+'#'+historyToken;
On 14 mei, 14:13, Bhavik <[email protected]> wrote:
> Hello Friends,
>
> I too recently had the same problem as yours. My requirement was a
> user can change the language on his wish from the ComboBox.
>
> So the solution I did with is I used JSNI (JavaScript Native
> Interface). - Javascript to be written into Java file.
>
> I put a combox. and on its "onSelect()" method in Listener Method of
> ComboBox, I get the value like "en_US" or "fr_FR" like this....
>
> Then I created an innerclass and created a JSNI method named
> changeLocale like :
>
> class Locale
> {
> private native void changeLocale(String newLocale)/*-{
>
> //alert("Language changed to : "+newLocale);
>
> var currLocation = $wnd.location.toString();
> //alert("currLocation : "+currLocation);
>
> var noHistoryCurrLocArray = currLocation.split("#");
> //alert("noHistoryCurrLocArray: "+noHistoryCurrLocArray);
>
> var noHistoryCurrLoc = noHistoryCurrLocArray[0];
> //alert("noHistoryCurrLoc : "+noHistoryCurrLoc);
>
> var locArray = noHistoryCurrLoc.split("?");
> //alert("locArray : "+locArray);
> $wnd.location.href = locArray[0]+"?locale="+newLocale; //$wnd
> }-*/;
> }
>
> Now in onSelect() method of Combobox create an instance of Locale and
> then call the changeLocale() native method.
>
> Good Luck. This will work as I did the same......
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---