From c0ad93d2fd698a17d3d14c1b0f52f2e2f5d71f50 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Wed, 23 Sep 2009 13:47:46 -0300 Subject: [PATCH] ActionItem830: rewriting forced default locale handling --- app/controllers/application.rb | 8 ++------ config/environment.rb | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 0958f7a..34b9b73 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -78,12 +78,8 @@ class ApplicationController < ActionController::Base end end def default_locale - if Noosfero.default_locale - if cookies[:lang].blank? - set_locale Noosfero.default_locale - else - set_locale cookies[:lang] - end + if Noosfero.default_locale && cookies[:lang].blank? + cookies[:lang] = params[:lang] = Noosfero.default_locale end end protected :maybe_save_locale, :default_locale diff --git a/config/environment.rb b/config/environment.rb index 217ab1e..2a21d2f 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -128,7 +128,7 @@ require 'noosfero' require 'sqlite_extension' # load a local configuration if present, but not under test environment. -if ENV['RAILS_ENV'] != 'test' +if !['test', 'cucumber'].include?(ENV['RAILS_ENV']) localconfigfile = File.join(RAILS_ROOT, 'config', 'local.rb') if File.exists?(localconfigfile) require localconfigfile -- libgit2 0.21.2