lib/rails/generators/component/component_generator.rb in view_component-2.46.0 vs lib/rails/generators/component/component_generator.rb in view_component-2.47.0
- old
+ new
@@ -13,19 +13,22 @@
check_class_collision suffix: "Component"
class_option :inline, type: :boolean, default: false
class_option :parent, type: :string, desc: "The parent class for the generated component"
class_option :stimulus, type: :boolean, default: ViewComponent::Base.generate_stimulus_controller
class_option :sidecar, type: :boolean, default: false
+ class_option :locale, type: :boolean, default: ViewComponent::Base.generate_locale
def create_component_file
template "component.rb", File.join(component_path, class_path, "#{file_name}_component.rb")
end
hook_for :test_framework
hook_for :preview, type: :boolean
hook_for :stimulus, type: :boolean
+
+ hook_for :locale, type: :boolean
hook_for :template_engine do |instance, template_engine|
instance.invoke template_engine, [instance.name]
end