Permalink
Browse files

i18n fixes for older Rails

  • Loading branch information...
1 parent cc6987f commit 502351660828d886965cb924a061c6b6521e9371 @mislav committed Aug 8, 2011
Showing with 3 additions and 1 deletion.
  1. +2 −1 lib/will_paginate.rb
  2. +1 −0 lib/will_paginate/i18n.rb
@@ -90,7 +90,8 @@ def self.warn(message, callstack = caller)
WillPaginate.enable_actionpack if defined? ActionController
end
-if defined? I18n
+# load default translations only for newer versions of I18n
+if defined? I18n and not defined? I18n::Backend::Simple::MATCH
require 'will_paginate/i18n'
I18n.load_path.unshift(*WillPaginate::I18n.load_path)
end
@@ -14,6 +14,7 @@ def will_paginate_translate(keys, options = {})
defaults << Proc.new if block_given?
::I18n.translate(defaults.shift, options.merge(:default => defaults, :scope => :will_paginate))
else
+ key = keys.respond_to?(:first) ? keys.first : keys
yield key, options
end
end

0 comments on commit 5023516

Please sign in to comment.