Sha256: 6e99832aa9c9b09a444403c65337dcfc2d893d4bb528e459d459b207dd95fe09

Contents?: true

Size: 579 Bytes

Versions: 5

Compression:

Stored size: 579 Bytes

Contents

require 'active_generator/base'
require 'generators/locale/base'

module Locale
  class ControllerGenerator < Rails::Generators::NamedBase
    include ActiveGenerator::Base
    include Locale::Base

    source_root File.expand_path('../templates', __FILE__)
    argument :language, type: :string, required: false, default: 'en', desc: 'The locale alpha code'

    def create_controller_file
      assert_valid_language!
      path = File.join("config/locales/#{language}/controllers", namespace_path, "#{file_name}.yml")

      template('controller.yml', path)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_generator-4.0.6 lib/generators/locale/controller/controller_generator.rb
active_generator-4.0.5 lib/generators/locale/controller/controller_generator.rb
active_generator-4.0.4 lib/generators/locale/controller/controller_generator.rb
active_generator-4.0.3 lib/generators/locale/controller/controller_generator.rb
active_generator-4.0.2 lib/generators/locale/controller/controller_generator.rb