aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2011-08-09 21:09:10 +0100
committerRobin Houston <robin.houston@gmail.com>2011-08-09 21:09:10 +0100
commit7d1eb5df0c1bcc6a7a92755004faf85bc00496d4 (patch)
tree6f2cda5408b633662b865c1bc435cbb63b110ac8 /app/controllers/application_controller.rb
parentb6860bea9d4569a52801d72734fa86849c232721 (diff)
parente6fda87211f3c525c17b0d8a2c039192a6c18bb6 (diff)
Merge branch 'master' into wdtk
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 5f18be2e5..0d8c83d6c 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -42,7 +42,11 @@ class ApplicationController < ActionController::Base
end
def set_gettext_locale
- requested_locale = params[:locale] || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE']
+ if MySociety::Config.get('USE_DEFAULT_BROWSER_LANGUAGE', true)
+ requested_locale = params[:locale] || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || I18n.default_locale
+ else
+ requested_locale = params[:locale] || session[:locale] || cookies[:locale] || I18n.default_locale
+ end
session[:locale] = FastGettext.set_locale(requested_locale)
end
@@ -221,7 +225,11 @@ class ApplicationController < ActionController::Base
if session[:user_id].nil?
return nil
else
- return User.find(session[:user_id])
+ begin
+ return User.find(session[:user_id])
+ rescue ActiveRecord::RecordNotFound
+ return nil
+ end
end
end