diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-11-28 15:57:58 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-11-28 15:57:58 +0000 |
commit | 3421afdb9eb79effa562ded447923b529ef8b714 (patch) | |
tree | ad297aa02f9532e92f7d74f7cf0d7c8c22ea6600 /app/controllers/application_controller.rb | |
parent | 49b932b3eed546752819ec9f286aa8de79eb2813 (diff) |
Give the implicit default locale in a URL without locale precedence over the session in the case where the default locale is not being included in URLs. This allows the user to return to the default locale.
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f9649c868..320d0cc50 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -54,10 +54,15 @@ class ApplicationController < ActionController::Base end def set_gettext_locale + if Configuration::include_default_locale_in_urls == false + params_locale = params[:locale] ? params[:locale] : I18n.default_locale + else + params_locale = params[:locale] + end if Configuration::use_default_browser_language - requested_locale = params[:locale] || session[:locale] || cookies[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'] || I18n.default_locale + 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 + requested_locale = params_locale || session[:locale] || cookies[:locale] || I18n.default_locale end requested_locale = FastGettext.best_locale_in(requested_locale) session[:locale] = FastGettext.set_locale(requested_locale) |