Commit c0ad93d2fd698a17d3d14c1b0f52f2e2f5d71f50
1 parent
5c2c22bf
Exists in
staging
and in
42 other branches
ActionItem830: rewriting forced default locale handling
Showing
2 changed files
with
3 additions
and
7 deletions
Show diff stats
app/controllers/application.rb
| ... | ... | @@ -78,12 +78,8 @@ class ApplicationController < ActionController::Base |
| 78 | 78 | end |
| 79 | 79 | end |
| 80 | 80 | def default_locale |
| 81 | - if Noosfero.default_locale | |
| 82 | - if cookies[:lang].blank? | |
| 83 | - set_locale Noosfero.default_locale | |
| 84 | - else | |
| 85 | - set_locale cookies[:lang] | |
| 86 | - end | |
| 81 | + if Noosfero.default_locale && cookies[:lang].blank? | |
| 82 | + cookies[:lang] = params[:lang] = Noosfero.default_locale | |
| 87 | 83 | end |
| 88 | 84 | end |
| 89 | 85 | protected :maybe_save_locale, :default_locale | ... | ... |
config/environment.rb
| ... | ... | @@ -128,7 +128,7 @@ require 'noosfero' |
| 128 | 128 | require 'sqlite_extension' |
| 129 | 129 | |
| 130 | 130 | # load a local configuration if present, but not under test environment. |
| 131 | -if ENV['RAILS_ENV'] != 'test' | |
| 131 | +if !['test', 'cucumber'].include?(ENV['RAILS_ENV']) | |
| 132 | 132 | localconfigfile = File.join(RAILS_ROOT, 'config', 'local.rb') |
| 133 | 133 | if File.exists?(localconfigfile) |
| 134 | 134 | require localconfigfile | ... | ... |