diff --git a/lib/i18n.rb b/lib/i18n.rb index ba29a1e1..e998b4a8 100644 --- a/lib/i18n.rb +++ b/lib/i18n.rb @@ -192,7 +192,7 @@ def eager_load! # I18n.t(:salutation, { :gender => 'w', :name => 'Smith' }) # I18n.t(:salutation, any_hash) # - def translate(key = nil, *, throw: false, raise: false, locale: nil, **options) # TODO deprecate :raise + def translate(key = nil, throw: false, raise: false, locale: nil, **options) # TODO deprecate :raise locale ||= config.locale raise Disabled.new('t') if locale == false enforce_available_locales!(locale) @@ -217,8 +217,8 @@ def translate(key = nil, *, throw: false, raise: false, locale: nil, **options) # Wrapper for translate that adds :raise => true. With # this option, if no translation is found, it will raise I18n::MissingTranslationData - def translate!(key, options = EMPTY_HASH) - translate(key, **options.merge(:raise => true)) + def translate!(key, **options) + translate(key, **options, raise: true) end alias :t! :translate! @@ -281,7 +281,7 @@ def exists?(key, _locale = nil, locale: _locale, **options) # I18n.transliterate("Jürgen") # => "Juergen" # I18n.transliterate("Jürgen", :locale => :en) # => "Jurgen" # I18n.transliterate("Jürgen", :locale => :de) # => "Juergen" - def transliterate(key, *, throw: false, raise: false, locale: nil, replacement: nil, **options) + def transliterate(key, throw: false, raise: false, locale: nil, replacement: nil, **options) locale ||= config.locale raise Disabled.new('transliterate') if locale == false enforce_available_locales!(locale) diff --git a/test/api/override_test.rb b/test/api/override_test.rb index 1345bbc1..41b14d2d 100644 --- a/test/api/override_test.rb +++ b/test/api/override_test.rb @@ -2,8 +2,8 @@ class I18nOverrideTest < I18n::TestCase module OverrideInverse - def translate(*args, **options) - super(*args, **options).reverse + def translate(key, **options) + super(key, **options).reverse end alias :t :translate end @@ -33,7 +33,7 @@ def setup test "make sure modules can overwrite I18n signature" do exception = catch(:exception) do - @I18n.t('Hello', 'Welcome message on home page', :tokenize => true, :throw => true) + @I18n.t('Hello', :tokenize => true, :throw => true) end assert exception.message @I18n.extend OverrideSignature