class Notifications::Generators::I18nGenerator

Public Instance Methods

add_locales() click to toggle source
# 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