diff --git a/actionpack/lib/action_controller/dispatcher.rb b/actionpack/lib/action_controller/dispatcher.rb index 28f8ce3d536299be4ddbafe5cc6e53d23901733b..f3e173004a76ad702d45c2a06158efcbbc32f800 100644 --- a/actionpack/lib/action_controller/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatcher.rb @@ -28,6 +28,10 @@ def define_dispatcher_callbacks(cache_classes) end after_dispatch :flush_logger if Base.logger && Base.logger.respond_to?(:flush) + + to_prepare do + I18n.reload! + end end # Backward-compatible class method takes CGI-specific args. Deprecated diff --git a/actionpack/test/template/translation_helper_test.rb b/actionpack/test/template/translation_helper_test.rb index 7b94221ec060e58637f2ea1ca2287dc82021ad56..1b28a5928884a42e899a8435d530b62bf7343006 100644 --- a/actionpack/test/template/translation_helper_test.rb +++ b/actionpack/test/template/translation_helper_test.rb @@ -10,8 +10,8 @@ def setup end def test_delegates_to_i18n_setting_the_raise_option - I18n.expects(:translate).with(:foo, 'en-US', :raise => true) - translate :foo, 'en-US' + I18n.expects(:translate).with(:foo, :locale => 'en-US', :raise => true) + translate :foo, :locale => 'en-US' end def test_returns_missing_translation_message_wrapped_into_span diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 903c7b6e7652d769b915fea9aaea210b8f5040c5..24a7f1639eb1033698a3f79d422b2dc449c6194e 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,6 +1,6 @@ *2.2.1 [RC2 or 2.2 final]* -* Make I18n::Backend::Simple reload its translations in development mode [DHH] +* Make I18n::Backend::Simple reload its translations in development mode [DHH/Sven Fuchs] *2.2.0 [RC1] (October 24th, 2008)* diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb index 9b0b69f58b970b45da3ed365625da58e2921ed64..40e82d8225cc8fd5ff71f8c510646f27f499dbbf 100755 --- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb @@ -67,6 +67,13 @@ def load_path def load_path=(load_path) @@load_path = load_path end + + # Tells the backend to reload translations. Used in situations like the + # Rails development environment. Backends can implement whatever strategy + # is useful. + def reload! + backend.reload! + end # Translates, pluralizes and interpolates a given key using a given locale, # scope, and default, as well as interpolation values. diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb index c682eadf85141e75a3339d7e790929811174160e..bdda55d3feebd77e64e3a19969b1de8c7b30fd91 100644 --- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb @@ -69,8 +69,9 @@ def initialized? @initialized ||= false end - def reload + def reload! @initialized = false + @translations = nil end protected