lib/pagy/i18n.rb in pagy-5.6.4 vs lib/pagy/i18n.rb in pagy-5.6.5
- old
+ new
@@ -151,13 +151,14 @@
build(*locales)
DATA.freeze
end
# Translate and pluralize the key with the locale DATA
- def t(locale, key, opts = {})
+ def translate(locale, key, opts = {})
data, pluralize = DATA[locale]
translation = data[key] || (opts[:count] && data[key += ".#{pluralize.call(opts[:count])}"]) \
or return %([translation missing: "#{key}"])
translation.gsub(/%{[^}]+?}/) { |match| opts[:"#{match[2..-2]}"] || match }
end
+ alias t translate
end
end