Sha256: 313e6868a482b668713bec75324ed34dca42a6482b6f145199c563fad9a1f31d

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

namespace :translation_center do

  def send_exception(exception)
    puts "An error has occurred, you can help us fix this by submitting the stacktrace to us and we will try to fix this problem, enter 'y' to send."
    confirm = $stdin.gets.chomp
    if confirm == 'y' || confirm == 'yes'
      puts exception.message
    end
  end

  desc "Insert yaml translations in db"
  task :yaml2db, [:locale ] => :environment do |t, args|
    begin
      TranlationCenter.yaml2db(args[:locale])
    rescue Exception => e
      send_exception(e)
    end
  end

  desc "Export translations from db to yaml"
  task :db2yaml, [:locale ] => :environment do |t, args|
    begin
      TranslationCenter.db2yaml(args[:locale])
    rescue Exception => e
      send_exception(e)
    end
  end

  desc "Calls yaml2db then db2yaml"
  task :synch, [:locale ] => :environment do |t, args|
    TranslationCenter.yaml2db(args[:locale])
    TranslationCenter.db2yaml(args[:locale])
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_center-1.3.1 lib/tasks/translation_center.rake