Class: Notifications::Generators::I18nGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/notifications/i18n_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_localesObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/notifications/i18n_generator.rb', line 8

def add_locales
  %w(en.yml zh-CN.yml).each do |fname|
    path = "#{Rails.root}/config/locales/notifications.#{fname}"
    if File.exist?(path)
      puts "Skipping config/locales/notifications.#{fname} creation, as file already exists!"
    else
      puts "Adding locale (config/locales/notifications.#{fname})..."
      template "config/locales/notifications.#{fname}", path
    end
  end
end