Sha256: 3f8383950fe09e60b7af1a53c0aff65c504cf7842cc2a6a1b699d5102edadd02

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

# encoding: utf-8
require 'rake'
require 'web_translate_it'
namespace :trans do  
  desc "Fetch translation files from Web Translate It"
  task :fetch, :locale do |task, args|
    WebTranslateIt::Util.welcome_message
    puts "Fetching file for localeĀ #{args.locale}..."
    configuration = WebTranslateIt::Configuration.new
    configuration.files.find_all{ |file| file.locale == args.locale }.each do |file|
      puts file.file_path + ": " + file.fetch
    end
  end
  
  namespace :fetch do
    desc "Fetch all the translation files from Web Translate It"
    task :all do
      WebTranslateIt::Util.welcome_message
      configuration = WebTranslateIt::Configuration.new
      locales = configuration.target_locales
      configuration.ignore_locales.each{ |locale_to_ignore| locales.delete(locale_to_ignore) }
      puts "Fetching all files for all locales..."
      locales.each do |locale|
        configuration.files.find_all{ |file| file.locale == locale }.each do |file|
          puts file.file_path + " " + file.fetch
        end
      end
    end
  end
  
  desc "Upload the translation files for a locale to Web Translate It"
  task :upload, :locale do |task, args|
    WebTranslateIt::Util.welcome_message
    puts "Uploading file for localeĀ #{args.locale}..."
    configuration = WebTranslateIt::Configuration.new
    configuration.files.find_all{ |file| file.locale == args.locale }.each do |file|
      puts file.file_path + " " + file.upload
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
web_translate_it-1.7.3.1 lib/web_translate_it/tasks.rb
web_translate_it-1.7.3.0 lib/web_translate_it/tasks.rb
web_translate_it-1.7.2.1 lib/web_translate_it/tasks.rb
web_translate_it-1.7.2.0 lib/web_translate_it/tasks.rb
web_translate_it-1.7.1.7 lib/web_translate_it/tasks.rb
web_translate_it-1.7.1.6 lib/web_translate_it/tasks.rb
web_translate_it-1.7.1.5 lib/web_translate_it/tasks.rb