Skip to content
This repository
Browse code

i18n fixes for older Rails

  • Loading branch information...
commit 502351660828d886965cb924a061c6b6521e9371 1 parent cc6987f
Mislav Marohnić authored

Showing 2 changed files with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 1  lib/will_paginate.rb
  2. +1 0  lib/will_paginate/i18n.rb
3  lib/will_paginate.rb
@@ -90,7 +90,8 @@ def self.warn(message, callstack = caller)
90 90 WillPaginate.enable_actionpack if defined? ActionController
91 91 end
92 92
93   -if defined? I18n
  93 +# load default translations only for newer versions of I18n
  94 +if defined? I18n and not defined? I18n::Backend::Simple::MATCH
94 95 require 'will_paginate/i18n'
95 96 I18n.load_path.unshift(*WillPaginate::I18n.load_path)
96 97 end
1  lib/will_paginate/i18n.rb
@@ -14,6 +14,7 @@ def will_paginate_translate(keys, options = {})
14 14 defaults << Proc.new if block_given?
15 15 ::I18n.translate(defaults.shift, options.merge(:default => defaults, :scope => :will_paginate))
16 16 else
  17 + key = keys.respond_to?(:first) ? keys.first : keys
17 18 yield key, options
18 19 end
19 20 end

0 comments on commit 5023516

Please sign in to comment.
Something went wrong with that request. Please try again.