discourse/discourse — pull request #1716 by ok-harry (2013-12-04 12:08:15+00:00)
Title: set_locale of application_controller.rb must be called earlier

The set_locale filter must be executed before check_xhr filter because check_xhr filter renders html in some cases.
And I think it is safe to execute set_locale filter as soon as possible.

Fixed bug:
Locale will be :en at the very first request after server restart regardless of your SiteSettings.default_locale when the first request is for some pages not skipping check_xhr filter.

Bug generation step:
1) Set your SiteSettings.default_locale to some locale other than :en.
2) Browse http://your.site.com/admin
3) Restart your server.
4) Refresh the page.