There is no way to change the locale without a reload. This is because GWT-Compiler generates several permutations of js-files. For each locale and for each browser type one. Reason is to optimize javascript size because just the code which is needed for browser and locale is really transfered.
If you have 2 locales and 5 supported browser types you got 2 * 5 = 10 permutations but just one is transfered. On 14 Mai, 15:48, Salvador Diaz <[email protected]> wrote: > $wnd.location.href = locArray[0]+"?locale="+newLocale; > > Doesn't that reload the whole app ? The OP specifically asked a > solution that didn't reload the whole app. > > Cheers, > > Salvador > > On 14 mai, 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 -~----------~----~----~----~------~----~------~--~---
