mirror of
https://github.com/github/rails.git
synced 2026-01-25 22:38:33 -05:00
Proper API for reloading translations
This commit is contained in:
@@ -28,6 +28,10 @@ module ActionController
|
||||
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
|
||||
|
||||
@@ -10,8 +10,8 @@ class TranslationHelperTest < Test::Unit::TestCase
|
||||
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
|
||||
|
||||
@@ -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)*
|
||||
|
||||
@@ -67,6 +67,13 @@ module I18n
|
||||
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.
|
||||
|
||||
@@ -69,8 +69,9 @@ module I18n
|
||||
@initialized ||= false
|
||||
end
|
||||
|
||||
def reload
|
||||
def reload!
|
||||
@initialized = false
|
||||
@translations = nil
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
Reference in New Issue
Block a user