lib/locales/utils/loader.rb in pagy-3.7.3 vs lib/locales/utils/loader.rb in pagy-3.7.4

- old
+ new

@@ -18,9 +18,14 @@ # loader proc lambda do |i18n, *args| i18n.clear args.each do |arg| + if Pagy::DEPRECATED_LOCALES.key?(arg[:locale]) + new_locale = Pagy::DEPRECATED_LOCALES[arg[:locale]] + $stderr.puts("WARNING: the Pagy locale '#{arg[:locale]}' is deprecated; use '#{new_locale}' instead") + arg[:locale] = new_locale + end arg[:filepath] ||= Pagy.root.join('locales', "#{arg[:locale]}.yml") arg[:pluralize] ||= plurals[arg[:locale]] hash = YAML.load(File.read(arg[:filepath], encoding: 'UTF-8')) #rubocop:disable Security/YAMLLoad hash.key?(arg[:locale]) or raise VariableError, %(expected :locale "#{arg[:locale]}" not found in :filepath "#{arg[:filepath].inspect}") i18n[arg[:locale]] = [flatten.call(hash[arg[:locale]]), arg[:pluralize]]