Sha256: 5096d637538ec6759c709e8bebcac61b32f9e066785f003c6449d59c08d75467

Contents?: true

Size: 798 Bytes

Versions: 3

Compression:

Stored size: 798 Bytes

Contents

class I18nAttributes::InstallGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates', __FILE__)

  def create_initializer_file
    initializer 'i18n_attributes.rb' do
      %Q/
I18nAttributes.configure do |config|
  #more > I18n.available_locales
  config.locales = [:en, :"zh-CN"]
  config.enums_attributes = {
    "gender" => {"male" => "Male", "female" => "Female"},
    "state" => {"pending" => "Pending", "processing" => "Processing", "processed" => "Processed"},
    "category" => {"a" => "A", "b" => "B"}
  }
end
/
    end
  end

  def modify_application_config
    inject_into_file 'config/application.rb', :after => /< Rails::Application[\s]*$/ do
      %Q|
    config.i18n.load_path += Dir[%Q`\#{config.root}/config/locales/**/*.{rb,yml}`]
|
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
i18n_attributes-0.1.1.1 lib/generators/i18n_attributes/install/install_generator.rb
i18n_attributes-0.1.1 lib/generators/i18n_attributes/install/install_generator.rb
i18n_attributes-0.1.0 lib/generators/i18n_attributes/install/install_generator.rb