I searched on google and found different solution, here is the one we choose for GWT 1.5.3 (in 1.6 we will change our mind).
http://code.google.com/p/gwt-incubator-1-5-wiki/wiki/ServerSideLocaleSelection
If you want to set the locale, you can add this line to yout HTML page:
<meta name="gwt:property" content="locale=en"/>So if you want to find the user locale, juste change yout HTML file to JSP and replace the previous line with this block:
<meta name="gwt:property" content="locale=<%List<String> list = new ArrayList<String>();We just use a GWT 1.6 incubation class LocaleMatcher and we authorized two locale "fr" and "en" only. This code will use the favorite locale of the user that has been set in the browser configuration.
list.add("fr");
list.add("en");
LocaleMatcher localeMatcher = new LocaleMatcher(list);
String locale = localeMatcher.findBestMatch(request.getHeader("Accept-language"));
out.print(locale);%>"/>
We don't need to implement a special UI to manage the user locale, we use the browser feature.
Of course you must enable the locale in the module XML file too !!!
<extend-property name="locale" values="en"/>Here we choose to activate the possible locale by code with an Arraylist of the locale we accept to manage, but you can also use another GWT incubation class that scroll you module XML file to find the locale used by your module. That will probably a native feature of GWT 1.6 so wait and see in a few weeks (or months).