# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails' ###### GETTEXT TASKS ##### # Taken from "Using Gettext To Translate Your Rails Application" at # http://www.digitale-wertschoepfung.de/artikel/gettext/gettext.html require 'gettext/utils' desc "Create mo-files for L10n" task :makemo do LOCALE_DIR = 'locale' GetText.create_mofiles(true, 'po', LOCALE_DIR) # Move rails.mo files to right places: locale/LANG/LC_MESSAGES/rails.mo -> locale/LANG/rails.mo Dir.new(LOCALE_DIR).each do |filename| next if ['.', '..'].include?(filename) dirname = File.join(LOCALE_DIR, filename) next unless File.directory?(dirname) file_to_move = File.join(dirname, 'LC_MESSAGES', 'rails.mo') puts "Moving #{file_to_move} -> #{dirname}/rails.mo" unless File.exists?(file_to_move) puts "File #{file_to_move} not found. So we can't move it!" next end File.move(file_to_move, dirname) end end desc "Update pot/po files to match new version." task :updatepo do TEXT_DOMAIN = "norfello_cmms" VERSION = "NorfelloCMMS SVN trunk" GetText.update_pofiles(TEXT_DOMAIN, Dir.glob("{app,lib,config,commercial/app,commercial/lib,commercial/config}/**/*.{rb,rhtml}"), VERSION) end