aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-25 22:00:07 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-25 22:10:11 +0100
commit1177a40e68b6661d6d2cb4aefdd9a805459cd936 (patch)
tree642dfb90bd938a9bab69dcd5d730afa2f2631aad
parentc6104e6514d7e0af8dca92fcb40a6adb72e16611 (diff)
downloadrails-1177a40e68b6661d6d2cb4aefdd9a805459cd936.tar.gz
rails-1177a40e68b6661d6d2cb4aefdd9a805459cd936.tar.bz2
rails-1177a40e68b6661d6d2cb4aefdd9a805459cd936.zip
Fix i18n locales order test.
-rw-r--r--activesupport/lib/active_support/railtie.rb6
-rw-r--r--railties/lib/rails/engine.rb16
2 files changed, 14 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/railtie.rb b/activesupport/lib/active_support/railtie.rb
index bc0f99869c..a80fa77e1e 100644
--- a/activesupport/lib/active_support/railtie.rb
+++ b/activesupport/lib/active_support/railtie.rb
@@ -33,6 +33,7 @@ module I18n
railtie_name :i18n
# Initialize I18n load paths to an array
+ config.i18n.engines_load_path = []
config.i18n.load_path = []
initializer :initialize_i18n do
@@ -47,7 +48,10 @@ module I18n
# the load_path which should be appended to what's already set instead of overwritten.
config.after_initialize do |app|
app.config.i18n.each do |setting, value|
- if setting == :load_path
+ case setting
+ when :engines_load_path
+ app.config.i18n.load_path.unshift(*value)
+ when :load_path
I18n.load_path += value
else
I18n.send("#{setting}=", value)
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index e40052e0f1..a9c94bc020 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -57,12 +57,12 @@ module Rails
# Set the paths from which Rails will automatically load source files,
# and the load_once paths.
initializer :set_autoload_paths do |app|
- ActiveSupport::Dependencies.load_paths.concat(config.load_paths)
+ ActiveSupport::Dependencies.load_paths.unshift(*config.load_paths)
if reloadable?(app)
- ActiveSupport::Dependencies.load_once_paths.concat(config.load_once_paths)
+ ActiveSupport::Dependencies.load_once_paths.unshift(*config.load_once_paths)
else
- ActiveSupport::Dependencies.load_once_paths.concat(config.load_paths)
+ ActiveSupport::Dependencies.load_once_paths.unshift(*config.load_paths)
end
# Freeze so future modifications will fail rather than do nothing mysteriously
@@ -86,18 +86,20 @@ module Rails
end
end
+ # I18n load paths are a special case since the ones added
+ # later have higher priority.
initializer :add_locales do
- config.i18n.load_path.unshift(*paths.config.locales.to_a)
+ config.i18n.engines_load_path.concat(paths.config.locales.to_a)
end
initializer :add_view_paths do
views = paths.app.views.to_a
- ActionController::Base.view_paths.concat(views) if defined?(ActionController)
- ActionMailer::Base.view_paths.concat(views) if defined?(ActionMailer)
+ ActionController::Base.view_paths.unshift(*views) if defined?(ActionController)
+ ActionMailer::Base.view_paths.unshift(*views) if defined?(ActionMailer)
end
initializer :add_metals do
- Rails::Rack::Metal.paths.concat(paths.app.metals.to_a)
+ Rails::Rack::Metal.paths.unshift(*paths.app.metals.to_a)
end
initializer :load_application_initializers do