Class: Locale::Generators::ComponentGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
ViewComponent::AbstractGenerator
Defined in:
lib/rails/generators/locale/component_generator.rb

Instance Method Summary collapse

Methods included from ViewComponent::AbstractGenerator

#copy_view_file

Instance Method Details

#create_locale_fileObject



14
15
16
17
18
19
20
21
22
# File 'lib/rails/generators/locale/component_generator.rb', line 14

def create_locale_file
  if ViewComponent::Base.config.generate.distinct_locale_files
    I18n.available_locales.each do |locale|
      create_file destination(locale), translations_hash([locale]).to_yaml
    end
  else
    create_file destination, translations_hash(I18n.available_locales).to_yaml
  end
end