Skip to content

Commit

Permalink
Revert "make sure we use the provided :locale option if given" ... ba…
Browse files Browse the repository at this point in the history
…d idea. Thanks to Albert Llop for the headsup!

This reverts commit 3cbfb04.
  • Loading branch information
Sven Fuchs committed Dec 12, 2009
1 parent 8009aef commit 50555f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def reload!
def translate(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
key = args.shift
locale = options.key?(:locale) ? options.delete(:locale) : I18n.locale
locale = options.delete(:locale) || I18n.locale
raises = options.delete(:raise)
backend.translate(locale, key, options)
rescue I18n::ArgumentError => exception
Expand Down
7 changes: 5 additions & 2 deletions test/api/lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ def setup
assert_equal 'bar', I18n.t('foo|bar', :separator => '|')
end

define_method "test lookup: given nil as a locale it raises InvalidLocale" do
assert_raises(I18n::InvalidLocale) { I18n.t(:bar, :locale => nil) }
# In fact it probably *should* fail but Rails currently relies on using the default locale instead.
# So we'll stick to this for now until we get it fixed in Rails.
define_method "test lookup: given nil as a locale it does not raise but use the default locale" do
# assert_raises(I18n::InvalidLocale) { I18n.t(:bar, :locale => nil) }
assert_nothing_raised { I18n.t(:bar, :locale => nil) }
end
end
end
Expand Down

0 comments on commit 50555f6

Please sign in to comment.