forked from mislav/will_paginate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract translate helpers into WillPaginate::I18n module
- Loading branch information
Showing
5 changed files
with
52 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module WillPaginate | ||
module I18n | ||
def self.locale_dir | ||
File.expand_path('../locale', __FILE__) | ||
end | ||
|
||
def self.load_path | ||
Dir["#{locale_dir}/*.{rb,yml}"] | ||
end | ||
|
||
def will_paginate_translate(keys, options = {}) | ||
if defined? ::I18n | ||
defaults = Array(keys).dup | ||
defaults << Proc.new if block_given? | ||
::I18n.translate(defaults.shift, options.merge(:default => defaults, :scope => :will_paginate)) | ||
else | ||
yield key, options | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters