Sha256: 424268f2ef775296a5c74ba1a270199ce1611d3027fa08298281d2106b4250f3

Contents?: true

Size: 903 Bytes

Versions: 9

Compression:

Stored size: 903 Bytes

Contents

gettext_find_task = begin
                      Rake::Task['gettext:find']
                    rescue
                      nil
                    end

if gettext_find_task
  namespace :gettext do
    task :store_action_names => :environment do
      storage_file = "#{locale_path}/action_names.rb"
      puts "writing action translations to: #{storage_file}"

      klasses = Actions::EntryAction
                .subclasses
                .uniq
                .select do |action|
        src, = Object.const_source_location(action.to_s)
        src.start_with? @engine.root.to_s
      end

      File.write storage_file,
                 "# Autogenerated!\n" +
                 klasses
                 .map { |klass| %[_("#{klass.allocate.humanized_name}")] }
                 .sort
                 .join("\n") + "\n"
    end
  end

  gettext_find_task.enhance ['gettext:store_action_names']
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman-tasks-9.2.3 lib/tasks/gettext.rake
foreman-tasks-9.2.2 lib/tasks/gettext.rake
foreman-tasks-9.2.1 lib/tasks/gettext.rake
foreman-tasks-9.2.0 lib/tasks/gettext.rake
foreman-tasks-9.1.1 lib/tasks/gettext.rake
foreman-tasks-9.0.4 lib/tasks/gettext.rake
foreman-tasks-9.1.0 lib/tasks/gettext.rake
foreman-tasks-9.0.2 lib/tasks/gettext.rake
foreman-tasks-9.0.1 lib/tasks/gettext.rake