Sha256: e11496aeab44aca8fb74375ebf5d16d8e50c6f19cc5f233420956e61d69aaa3e

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

namespace :tolk do
  desc "Update locale"
  task :update_locale, [:old_name, :new_name] => :environment do |t, args|
    old_name, new_name = args[:old_name], args[:new_name]
    puts Tolk::Locale.rename(old_name, new_name)
  end

  desc "Add database tables, copy over the assets, and import existing translations"
  task :setup => :environment do
    system 'rails g tolk:install'

    Rake::Task['db:migrate'].invoke
    Rake::Task['tolk:sync'].invoke
    Rake::Task['tolk:import'].invoke
  end

  desc "Sync Tolk with the default locale's yml file"
  task :sync => :environment do
    Tolk::Locale.sync!
  end

  desc "Generate yml files for all the locales defined in Tolk"
  task :dump_all => :environment do
    Tolk::Locale.dump_all
  end

  desc "Generate a single yml file for a specific locale"
  task :dump_yaml, [:locale] => :environment do
    Tolk::Locale.dump_yaml(locale)
  end

  desc "Imports data all non default locale yml files to Tolk"
  task :import => :environment do
    Rake::Task['tolk:sync'].invoke
    Tolk::Locale.import_secondary_locales
  end

  desc "Show all the keys potentially containing HTML values and no _html postfix"
  task :html_keys => :environment do
    bad_translations = Tolk::Locale.primary_locale.translations_with_html
    bad_translations.each do |bt|
      puts "#{bt.phrase.key} - #{bt.text}"
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tolk-1.6.0 lib/tasks/tolk_tasks.rake
tolk-1.5.2 lib/tasks/tolk_tasks.rake
tolk-1.6.0.alpha1 lib/tasks/tolk_tasks.rake
tolk-1.5.1 lib/tasks/tolk_tasks.rake
tolk-1.5.0 lib/tasks/tolk_tasks.rake