Bug 752215

Summary: at runtime, automatically detect what GWT locale to use as the default, based on the user's browser preferences
Product: [Other] RHQ Project Reporter: Ian Springer <ian.springer>
Component: Core UIAssignee: Nobody <nobody>
Status: ON_DEV --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2CC: hrupp, mazz
Target Milestone: ---Keywords: Improvement
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 4.3.0 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 735475    

Description Ian Springer 2011-11-08 20:52:06 UTC
See http://learngwt.com/articles/mdamour1976/AutomaticGWTInternationalizationdetection.html for some good ideas on how to do 
this.

Comment 1 Heiko W. Rupp 2011-11-08 21:07:50 UTC
Can  vote for this? :-)

Comment 2 Ian Springer 2011-11-08 22:51:59 UTC
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...

Comment 3 John Mazzitelli 2012-02-10 21:07:02 UTC
> <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.

Comment 4 John Mazzitelli 2012-02-13 19:03:43 UTC
*** Bug 701878 has been marked as a duplicate of this bug. ***

Comment 5 Mike Thompson 2012-02-13 19:10:26 UTC
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.

Comment 6 Mike Thompson 2012-02-13 19:31:07 UTC
Committed to the branch: feature/gwt-upgrade
Commit: http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=70f4a60a2aaabbdbad567794df8de6ab016c773b

Comment 7 Mike Thompson 2012-02-17 16:15:09 UTC
Need to add the server-side piece of this to work properly for all browsers.

Comment 8 Mike Thompson 2012-05-24 14:50:03 UTC
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.