diff --git a/lib/i18n_interpolation_fallbacks.rb b/lib/i18n_interpolation_fallbacks.rb index 45c6dfe59b7e41133c8f8cd0fca06cf75eb7b4e5..067601bcb7db765f9f1317d5285ce5539bc59097 100644 --- a/lib/i18n_interpolation_fallbacks.rb +++ b/lib/i18n_interpolation_fallbacks.rb @@ -17,7 +17,7 @@ module I18n options.delete(:fallback) return super(locale, nil, options.merge(:default => default)) if default - raise(I18n::MissingInterpolationError.new(locale, key, options)) + raise(I18n::MissingInterpolationArgument.new(options, "key: #{key} in locale: #{locale}")) end end end diff --git a/spec/misc_spec.rb b/spec/misc_spec.rb index d11402caaec1098a2ac1cf7e4292b7c96431515c..83af6674cefdda9863de6adf58e8aaaf73d8c727 100644 --- a/spec/misc_spec.rb +++ b/spec/misc_spec.rb @@ -75,6 +75,14 @@ describe 'making sure the spec runner works' do translation = translate('bob', :hey => "what") translation.should == "English translation" end + it 'MissingInterpolationError with no fallback is fatal' do + I18n.backend.stub!(:lookup). + with(:en, 'bob', nil, :hey => "what", :fallback => true). + and_return("English translation %{that_will_fail}") + lambda { + translate('bob', :hey => "what") + }.should raise_error I18n::MissingInterpolationArgument + end end end