Sha256: 8c61b86b198bacc4ee63448cb8b83e31f203ef2a2b989482fd128a5815923f8f
Contents?: true
Size: 1.22 KB
Versions: 19
Compression:
Stored size: 1.22 KB
Contents
require 'fileutils' namespace :merb_global do task :merb_start do Merb.start_environment :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'development' end desc 'Create migration' task :migration => :merb_start do Merb::Global::MessageProviders.provider.create! end desc 'Transfer the translations from one provider to another' task :transfer => :merb_start do from = Merb::Global.config 'source', 'gettext' into = Merb::Global.config 'provider', 'gettext' if from == 'gettext' and into == 'gettext' Dir[Merb::Global::MessageProviders.localedir + '/*.po'].each do |file| lang = File.basename file, '.po' lang_dir = File.join(Merb::Global::MessageProviders.localedir, lang, 'LC_MESSAGES') FileUtils.mkdir_p lang_dir domain = Merb::Global.config([:gettext, :domain], 'merbapp') `msgfmt #{file} -o #{lang_dir}/#{domain}.mo` end elsif from == into Merb.logger.error 'Tried transfer from and into the same provider' else from = Merb::Global::MessageProviders[from] into = Merb::Global::MessageProviders[into] Merb::Global::Provider.transfer from, into end end end
Version data entries
19 entries across 19 versions & 3 rubygems