@private
update mode options
update mode options
The result is written back to def.po.
--backup=CONTROL make a backup of def.po --suffix=SUFFIX override the usual backup suffix
The version control method may be selected via the –backup option or through the VERSION_CONTROL environment variable. Here are the values:
none, off never make backups (even if --backup is given) numbered, t make numbered backups existing, nil numbered if numbered backups exist, simple otherwise simple, never always make simple backups
The backup suffix is `~', unless set with –suffix or the SIMPLE_BACKUP_SUFFIX environment variable.
# File lib/gettext/tools/msgmerge.rb, line 221 def initialize @definition_po = nil @reference_po = nil @update = false @output = nil @order = :references @po_format_options = { :max_line_width => POEntry::Formatter::DEFAULT_MAX_LINE_WIDTH, } @fuzzy = nil @update = nil @backup = ENV["VERSION_CONTROL"] @suffix = ENV["SIMPLE_BACKUP_SUFFIX"] || "~" @input_dirs = ["."] end
# File lib/gettext/tools/msgmerge.rb, line 237 def parse(command_line) parser = create_option_parser rest = parser.parse(command_line) if rest.size != 2 puts(parser.help) exit(false) end @definition_po, @reference_pot = rest @output = @definition_po if @update end
# File lib/gettext/tools/msgmerge.rb, line 251 def create_option_parser parser = OptionParser.new parser.banner = _("Usage: %s [OPTIONS] definition.po reference.pot") % $0 #parser.summary_width = 80 parser.separator("") description = _("Merges two Uniforum style .po files together. " + "The definition.po file is an existing PO file " + "with translations. The reference.pot file is " + "the last created PO file with up-to-date source " + "references. The reference.pot is generally " + "created by rxgettext.") parser.separator(description) parser.separator("") parser.separator(_("Specific options:")) parser.on("-U", "--[no-]update", _("Update definition.po")) do |update| @update = update end parser.on("-o", "--output=FILE", _("Write output to specified file")) do |output| @output = output end parser.on("--[no-]sort-output", _("Generate sorted output")) do |sort| @order = sort ? :references : nil end parser.on("--[no-]sort-by-file", _("Sort output by file location")) do |sort_by_file| @order = sort_by_file ? :references : :msgid end parser.on("--[no-]sort-by-msgid", _("Sort output by msgid")) do |sort_by_msgid| @order = sort_by_msgid ? :msgid : :references end parser.on("--[no-]location", _("Preserve '#: FILENAME:LINE' lines")) do |location| @po_format_options[:include_reference_comment] = location end parser.on("--width=WIDTH", Integer, _("Set output page width"), "(#{@po_format_options[:max_line_width]})") do |width| @po_format_options[:max_line_width] = width end parser.on("--[no-]wrap", _("Break long message lines, longer than the output page width, into several lines"), "(#{@po_format_options[:max_line_width] >= 0})") do |wrap| if wrap max_line_width = POEntry::Formatter::DEFAULT_MAX_LINE_WIDTH else max_line_width = -1 end @po_format_options[:max_line_width] = max_line_width end #parser.on("-F", "--fuzzy-matching") parser.on("-h", "--help", _("Display this help and exit")) do puts(parser.help) exit(true) end parser.on_tail("--version", _("Display version information and exit")) do puts(GetText::VERSION) exit(true) end parser end