Always set Globalize.locale after I18n.locale.
The test "Budget Investments Show milestones" was failing in certain cases where `Globalize.locale` had been changed in a previous test. Since having different values in `Globalize.locale` and `I18n.locale` has proven to be an issue on the test enviroment, this commit also changes application code in order to avoid similar situations on production. See issue #2718.
This commit is contained in:
@@ -59,6 +59,7 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
I18n.locale = locale
|
I18n.locale = locale
|
||||||
|
Globalize.locale = I18n.locale
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_layout
|
def set_layout
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ module Translatable
|
|||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
before_action :set_translation_locale
|
|
||||||
before_action :delete_translations, only: [:update]
|
before_action :delete_translations, only: [:update]
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -12,10 +11,6 @@ module Translatable
|
|||||||
resource_model.globalize_attribute_names.select { |k, v| params.include?(k.to_sym) && params[k].present? }
|
resource_model.globalize_attribute_names.select { |k, v| params.include?(k.to_sym) && params[k].present? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_translation_locale
|
|
||||||
Globalize.locale = I18n.locale
|
|
||||||
end
|
|
||||||
|
|
||||||
def delete_translations
|
def delete_translations
|
||||||
locales = resource_model.globalize_locales.
|
locales = resource_model.globalize_locales.
|
||||||
select { |k, v| params[:delete_translations].include?(k.to_sym) && params[:delete_translations][k] == "1" }
|
select { |k, v| params[:delete_translations].include?(k.to_sym) && params[:delete_translations][k] == "1" }
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class Management::BaseController < ActionController::Base
|
|||||||
session[:locale] ||= I18n.default_locale
|
session[:locale] ||= I18n.default_locale
|
||||||
|
|
||||||
I18n.locale = session[:locale]
|
I18n.locale = session[:locale]
|
||||||
|
Globalize.locale = I18n.locale
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_budget
|
def current_budget
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ RSpec.configure do |config|
|
|||||||
config.before do |example|
|
config.before do |example|
|
||||||
DatabaseCleaner.strategy = :transaction
|
DatabaseCleaner.strategy = :transaction
|
||||||
I18n.locale = :en
|
I18n.locale = :en
|
||||||
|
Globalize.locale = I18n.locale
|
||||||
load Rails.root.join('db', 'seeds.rb').to_s
|
load Rails.root.join('db', 'seeds.rb').to_s
|
||||||
Setting["feature.user.skip_verification"] = nil
|
Setting["feature.user.skip_verification"] = nil
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user