Skip to content

Commit

Permalink
refactoring of I18n extra using module prepend instead alias method c…
Browse files Browse the repository at this point in the history
…haining
  • Loading branch information
ddnexus committed Mar 8, 2021
1 parent df8607e commit f1d89a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/pagy/extras/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ module Frontend

Pagy::I18n.clear.instance_eval { undef :load; undef :t } # unload the pagy default constant for efficiency

alias_method :pagy_without_i18n, :pagy_t
def pagy_t_with_i18n(key, **opts) = ::I18n.t(key, **opts)
alias_method :pagy_t, :pagy_t_with_i18n
module I18n
def pagy_t(key, **opts) = ::I18n.t(key, **opts)
end
prepend I18n

end
end

0 comments on commit f1d89a5

Please sign in to comment.