Skip to content
Browse files

Add config files to generator template and make it actually work.

  • Loading branch information...
1 parent 0c0848f commit 22be151d009cb9ca3ec6f9b1c1772db625218cb5 @ugisozols ugisozols committed Dec 19, 2011
View
10 lib/generators/i18n_generator.rb
@@ -1,10 +0,0 @@
-module Refinery
- class I18nGenerator < Rails::Generators::Base
- source_root File.expand_path('../../../', __FILE__)
-
- def generate
- copy_file 'config/i18n-js.yml', Rails.root.join('config', 'i18n-js.yml')
- end
-
- end
-end
View
13 lib/generators/refinery/i18n_generator.rb
@@ -0,0 +1,13 @@
+module Refinery
+ class I18nGenerator < Rails::Generators::Base
+ source_root File.expand_path('../templates', __FILE__)
+
+ def generate_refinery_i18n_initializer
+ template "config/initializers/refinery_i18n.rb.erb", File.join(destination_root, "config", "initializers", "refinery_i18n.rb")
+ end
+
+ def generate_i18n_js
+ template "config/i18n-js.yml", File.join(destination_root, "config", "i18n-js.yml")
+ end
+ end
+end
View
0 i18n-js-readme.rdoc → ...nery/templates/config/i18n-js-readme.rdoc
File renamed without changes.
View
0 config/i18n-js.yml → ...ors/refinery/templates/config/i18n-js.yml
File renamed without changes.
View
11 lib/generators/refinery/templates/config/initializers/refinery_i18n.rb.erb
@@ -0,0 +1,11 @@
+Refinery::I18n.configure do |config|
+ # config.enabled = <%= Refinery::I18n.config.enabled %>
+
+ # config.default_locale = :<%= Refinery::I18n.config.default_locale %>
+
+ # config.default_frontend_locale = :<%= Refinery::I18n.config.default_frontend_locale %>
+
+ # config.frontend_locales = <%= Refinery::I18n.config.frontend_locales %>
+
+ # config.locales = <%= Refinery::I18n.config.locales %>
+end
View
3 lib/refinery/i18n.rb
@@ -3,6 +3,8 @@
require 'routing-filter'
module Refinery
+ autoload :I18nGenerator, 'generators/refinery/i18n_generator'
+
module I18n
class << self
attr_accessor :built_in_locales
@@ -57,4 +59,3 @@ def has_locale?(locale)
require 'refinery/i18n/configuration'
end
end
-
View
2 lib/refinerycms-i18n.rb
@@ -1 +1 @@
-require File.expand_path('../refinery/i18n', __FILE__)
+require 'refinery/i18n'

0 comments on commit 22be151

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