Skip to content

Commit

Permalink
Include all the defaults in I18n call
Browse files Browse the repository at this point in the history
Adjusts to change introduced in v1.9.0 of i18n

Ref: ruby-i18n/i18n#591
  • Loading branch information
movermeyer committed Feb 13, 2022
1 parent 09194c9 commit 171e7d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activemodel/lib/active_model/naming.rb
Expand Up @@ -197,11 +197,11 @@ def initialize(klass, namespace = nil, name = nil, locale = :en)
def human(options = {})
return @human if i18n_keys.empty? || i18n_scope.empty?

key, *defaults = i18n_keys
defaults = i18n_keys
defaults << options[:default] if options[:default]
defaults << MISSING_TRANSLATION

translation = I18n.translate(key, scope: i18n_scope, count: 1, **options, default: defaults)
translation = I18n.translate(defaults.first, scope: i18n_scope, count: 1, **options, default: defaults)
translation = @human if translation == MISSING_TRANSLATION
translation
end
Expand Down

0 comments on commit 171e7d9

Please sign in to comment.