Skip to content

Commit 8ad7fa7

Browse files
committedMar 30, 2014
Move I18n to its own initializer
1 parent 113198f commit 8ad7fa7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed
 

‎lib/paperclip/glue.rb

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ def self.included(base)
99
base.send :include, Callbacks
1010
base.send :include, Validators
1111
base.send :include, Schema if defined? ActiveRecord
12-
13-
locale_path = Dir.glob(File.dirname(__FILE__) + "/locales/*.{rb,yml}")
14-
I18n.load_path += locale_path unless I18n.load_path.include?(locale_path)
1512
end
1613
end
1714
end

‎lib/paperclip/railtie.rb

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ class Railtie < Rails::Railtie
1515
end
1616
end
1717

18+
initializer 'paperclip.i18n' do |app|
19+
locale_path = Dir.glob(File.dirname(__FILE__) + "/locales/*.{rb,yml}")
20+
I18n.load_path += locale_path unless I18n.load_path.include?(locale_path)
21+
end
22+
1823
rake_tasks { load "tasks/paperclip.rake" }
1924
end
2025

‎spec/spec_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
ActiveRecord::Base.establish_connection(config['test'])
2323
Paperclip.options[:logger] = ActiveRecord::Base.logger
2424

25+
I18n.load_path += Dir.glob(File.join(ROOT, 'lib', 'paperclip', 'locales', '*.{rb,yml}'))
26+
2527
Dir[File.join(ROOT, 'spec', 'support', '**', '*.rb')].each{|f| require f }
2628

2729
Rails = FakeRails.new('test', Pathname.new(ROOT).join('tmp'))

0 commit comments

Comments
 (0)
Please sign in to comment.