lib/gettext/tools.rb
# Merges two Uniforum style .po files together. 
#
# *Note* This function requires "msgmerge" tool included in GNU GetText. So you need to install GNU GetText. 
#
# The def.po file is an existing PO file with translations which will be taken 
# over to the newly created file as long as they still match; comments will be preserved,
# but extracted comments and file positions will be discarded. 
#
# The ref.pot file is the last created PO file with up-to-date source references but
# old translations, or a PO Template file (generally created by rgettext);
# any translations or comments in the file will be discarded, however dot
# comments and file positions will be preserved.  Where an exact match
# cannot be found, fuzzy matching is used to produce better results.
#
# Usually you don't need to call this function directly. Use GetText.update_pofiles instead.
#
# * defpo: a po-file. translations referring to old sources
# * refpo: a po-file. references to new sources
# * app_version: the application information which appears "Project-Id-Version: #{app_version}" in the pot/po-files.
# * Returns: self 
Merges two Uniforum style .po files together.
Note* This function requires "msgmerge" tool included in GNU GetText. So you need to install GNU GetText.

The def.po file is an existing PO file with translations which will be taken
over to the newly created file as long as they still match; comments will be preserved,
but extracted comments and file positions will be discarded.

The ref.pot file is the last created PO file with up-to-date source references but
old translations, or a PO Template file (generally created by rgettext);
any translations or comments in the file will be discarded, however dot
comments and file positions will be preserved.  Where an exact match
cannot be found, fuzzy matching is used to produce better results.

Usually you don't need to call this function directly.

a po-file. translations referring to old sources
refpo: a po-file. references to new sources
app_version: the application information which appears "Project-Id-Version: #{app_version}" in the pot/po-files.
Returns: self
Merges two Uniforum style . po files together . Note * This function requires " msgmerge " tool included in GNU GetText . So you need to install GNU GetText . The def . po file is an existing PO file with translations which will be taken over to the newly created file as long as they still match ; comments will be preserved but extracted comments and file positions will be discarded . The ref . pot file is the last created PO file with up - to - date source references but old translations or a PO Template file ( generally created by rgettext ) ; any translations or comments in the file will be discarded however dot comments and file positions will be preserved . Where an exact match cannot be found fuzzy matching is used to produce better results . Usually you don ' t need to call this function directly . a po - file . translations referring to old sources refpo : a po - file . references to new sources app_version : the application information which appears " Project - Id - Version : # { app_version } " in the pot / po - files . Returns : self
def msgmerge(defpo, refpo, app_version, options={})
    verbose = options.delete(:verbose)
    puts "msgmerge called" if verbose
    $stderr.print defpo + " "
    content = merge_po_files(defpo,refpo,options.delete(:msgmerge),verbose)
    if content.empty?
      failed_filename = refpo + "~"
      FileUtils.cp(refpo, failed_filename)
      $stderr.puts _("Failed to merge with %{defpo}") % {:defpo => defpo}
      $stderr.puts _("New .pot was copied to %{failed_filename}") %{:failed_filename => failed_filename}
      raise _("Check these po/pot-files. It may have syntax errors or something wrong.")
    else
      content.sub!(/(Project-Id-Version\:).*$/, "\\1 #{app_version}\\n\"")
      File.open(defpo, "w") {|f|f.write(content)}
    end
    self
  end
def msgmerge ( defpo , refpo , app_version , options = { } ) verbose = options . delete ( :verbose ) puts "msgmerge called" if verbose $stderr . print defpo + " " content = merge_po_files ( defpo , refpo , options . delete ( :msgmerge ) , verbose ) if content . empty? failed_filename = refpo + "~" FileUtils . cp ( refpo , failed_filename ) $stderr . puts _ ( "Failed to merge with %{defpo}" ) % { :defpo => defpo } $stderr . puts _ ( "New .pot was copied to %{failed_filename}" ) % { :failed_filename => failed_filename } raise _ ( "Check these po/pot-files. It may have syntax errors or something wrong." ) else content . sub! ( / (Project-Id-Version \: ).*$ / , "\\1 #{app_version}\\n\"" ) File . open ( defpo , "w" ) { | f | f . write ( content ) } end self end
Merges two Uniforum style .po files together.
Merges two Uniforum style . po files together .
# report failure # update version and save merged data
defpo
<not_specific>
refpo
<not_specific>
app_version
<not_specific>
options
<not_specific>