Red Hat Bugzilla – Bug 752215
at runtime, automatically detect what GWT locale to use as the default, based on the user's browser preferences
Last modified: 2015-02-01 18:29:29 EST
See http://learngwt.com/articles/mdamour1976/AutomaticGWTInternationalizationdetection.html for some good ideas on how to do
Can vote for this? :-)
In GWT 2.3, there is a new feature that allows you to configure a module to default to the browser locale, by adding the following line to the module.gwt.xml file:
<set-configuration-property name="locale.useragent" value="Y"/>
However, according to http://stackoverflow.com/questions/156412/why-does-gwt-ignore-browser-locale, this feature does not work in IE...
> <set-configuration-property name="locale.useragent" value="Y"/>
I can't get this to work with either FF or Chrome. I must be missing something or this isn't the only thing you need to do.
*** Bug 701878 has been marked as a duplicate of this bug. ***
By Adding two lines to the GWT configuration
<set-configuration-property name="locale.usemeta" value="N"/>
<set-configuration-property name="locale.searchorder" value="queryparam,useragent,cookie"/>
The first line is just for good measure in case someone every puts a language meta tag in the page then we will ignore that use the query param followed by the browser agent instead.
I configured my browser for german and tested against FF and chrome but not on IE yet.
Committed to the branch: feature/gwt-upgrade
Need to add the server-side piece of this to work properly for all browsers.
Just need to update the status here to be more explicit where this is and what's left to do.
Core Problem: IE populates the 'Accept-Language' with 'en-US' which is a totally different format than firefox or chrome which use the format: en,de;q=0.8,ja;q=0.7,pt;q=0.5,en-us;q=0.3,en-gb;q=0.2' So different parsing is required for different browsers, but because this is a header only server side resources can parse the header.
The current situation is browser settings for languages work with browsers other than IE. For IE to work properly I need to get at the browser headers (which can't be done in gwt) but instead, though some server side technology such as seam or jsp that allows us to get at the request headers ('Accept-Language'). Currently, the gwt app page that servers up coregui is an html page (no server side). This html page would need to change to a jsp or xhtml(seam) page and some logic to get the language based on the browser applied.