lib/pagy/i18n.rb in pagy-8.6.3 vs lib/pagy/i18n.rb in pagy-9.0.0

- old
+ new

@@ -152,10 +152,10 @@ build(*locales) DATA.freeze end # Translate and pluralize the key with the locale DATA - def translate(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