Class: GetText::Tools::MsgMerge

### Home Classes Methods

### In Files

- lib/gettext/tools/msgmerge.rb

### Parent

Object

### Namespace

- CLASS GetText::Tools::MsgMerge::Config
- CLASS GetText::Tools::MsgMerge::FuzzyEntryFinder
- CLASS GetText::Tools::MsgMerge::Merger

### Methods

- ::run
- #run

### Class/Module Index

Quicksearch

- GetText
- GetText::ClassInfo
- GetText::ErbParser
- GetText::GladeParser
- GetText::LocalePath
- GetText::MO
- GetText::MO::HeaderRev1
- GetText::MO::InvalidFormat
- GetText::NoboundTextDomainError
- GetText::PO
- GetText::PO::NonExistentEntryError
- GetText::POEntry
- GetText::POEntry::Formatter
- GetText::POEntry::InvalidTypeError
- GetText::POEntry::NoMsgctxtError
- GetText::POEntry::NoMsgidError
- GetText::POEntry::NoMsgidPluralError
- GetText::POEntryForRubyParser
- GetText::POFormat
- GetText::POParser
- GetText::ParseError
- GetText::RubyParser
- GetText::TextDomain
- GetText::TextDomainGroup
- GetText::TextDomainManager
- GetText::Tools
- GetText::Tools::MsgCat
- GetText::Tools::MsgCat::Config
- GetText::Tools::MsgCat::Merger
- GetText::Tools::MsgInit
- GetText::Tools::MsgInit::ArgumentError
- GetText::Tools::MsgInit::Error
- GetText::Tools::MsgInit::ValidationError
- GetText::Tools::MsgMerge
- GetText::Tools::MsgMerge::Config
- GetText::Tools::MsgMerge::FuzzyEntryFinder
- GetText::Tools::MsgMerge::Merger
- GetText::Tools::Task
- GetText::Tools::Task::Error
- GetText::Tools::Task::Path
- GetText::Tools::Task::ValidationError
- GetText::Tools::XGetText

No matching classes.

# GetText::Tools::MsgMerge

### Public Class Methods

run(*command_line) click to toggle source

(see run)

This method is provided just for convenience. It equals to `new.run(*command_line)`.

    # File lib/gettext/tools/msgmerge.rb, line 36
    def run(*command_line)
      new.run(*command_line)
    end

### Public Instance Methods

run(*command_line) click to toggle source

Merge a po-file inluding translated messages and a new pot-file.

@param [Array<String>] command_line

    command line arguments for rmsgmerge.

@return [void]

    # File lib/gettext/tools/msgmerge.rb, line 46
    def run(*command_line)
      config = Config.new
      config.parse(command_line)

      parser = POParser.new
      parser.ignore_fuzzy = false
      definition_po = PO.new
      reference_pot = PO.new
      parser.parse_file(config.definition_po, definition_po)
      parser.parse_file(config.reference_pot, reference_pot)

      merger = Merger.new(reference_pot, definition_po, config)
      result = merger.merge
      result.order = config.order
      p result if $DEBUG
      print result.generate_po if $DEBUG

      if config.output.is_a?(String)
        File.open(File.expand_path(config.output), "w+") do |file|
          file.write(result.to_s(config.po_format_options))
        end
      else
        puts(result.to_s(config.po_format_options))
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.