Reviewers: , Description: When gwt application loads, it looks for the user language in url-params, meta-tags, and $wnd.__gwt_Locale.
However, it is possible to know the browser's locale in client side. Although it is not the locale configured by the user in the browser's preferences window (Accept-Language header), normally it is a language known by the user because she is using it in her computer. It covers a hight percentage of cases, working fine when a user selects the language at login time in linux, Mac, other un*x, and with the default user's language in windows. The patch simplifies the language selection in gwt apps, making in most cases not necessary to use server-side code. We use this approach at apache.org in James-Hupa. Thanks Manolo Please review this at http://gwt-code-reviews.appspot.com/109803 Affected files: src/com/google/gwt/i18n/I18N.gwt.xml Index: src/com/google/gwt/i18n/I18N.gwt.xml =================================================================== --- src/com/google/gwt/i18n/I18N.gwt.xml (revisiĆ³n: 7095) +++ src/com/google/gwt/i18n/I18N.gwt.xml (copia de trabajo) @@ -51,6 +51,14 @@ } else { $wnd['__gwt_Locale'] = locale || defaultLocale; } + + if (locale == null) { + // Use the browser's locale + locale = navigator.browserLanguage ? navigator.browserLanguage : navigator.language; + if (locale != null) { + locale = locale.replace(/-/g, '_'); + } + } if (locale == null) { return defaultLocale; -- http://groups.google.com/group/Google-Web-Toolkit-Contributors