Sha256: 7c371335174a655fd18012dd460135af3170458d2f31e977910a15ac89e736ef

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require "active_generator/base"
require "generators/locale/base"

module Locale
  class RespondersControllerGenerator < 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 copy_responders_controller_file
      assert_valid_language!
      template("responders_controller.yml", "config/locales/#{language}/responders_controllers/#{namespace_path}/#{file_name}.yml")
    end

  end
end

if ActiveGenerator.configuration.autoload_responders_controller_generator_locale
  begin
    require "rails/generators/rails/responders_controller/responders_controller_generator"

    Rails::Generators::RespondersControllerGenerator.class_eval do
      def generate_responders_controller_locale_file
        invoke("locale:responders_controller", [name])
      end
    end
  rescue LoadError => e
    # Skip over missing files
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_generator-2.0.11 lib/generators/locale/responders_controller/responders_controller_generator.rb