lib/gettext/tools/rmsgmerge.rb
# From GNU gettext source.
# 
# Merge the reference with the definition: take the #. and
#	#: comments from the reference, take the # comments from
# the definition, take the msgstr from the definition.  Add
# this merged entry to the output message list.      
From GNU gettext source.
Merge the reference with the definition: take the #. and
: comments from the reference, take the # comments from
the definition, take the msgstr from the definition.  Add
this merged entry to the output message list.
From GNU gettext source . Merge the reference with the definition : take the # . and : comments from the reference take the # comments from the definition take the msgstr from the definition . Add this merged entry to the output message list .
def merge(definition, reference)
        result = Marshal.load( Marshal.dump(reference) )        
        used = []        
        merge_header(result, definition)
        result.each_msgid do |msgid|
          if definition.msgid?(msgid)
            used << msgid
            merge_message(msgid, result, msgid, definition)
          elsif other_msgid = definition.search_msgid_fuzzy(msgid, used)
            used << other_msgid
            merge_fuzzy_message(msgid, result, other_msgid, definition) 
          elsif msgid.index("\000") and ( reference.msgstr(msgid).gsub("\000", '') == '' )
            result[msgid] = "\000" * definition.nplural
          else
            change_reference_comment(msgid, result)
          end          
        end
        last_comment = result.comment(:last) || ''
        definition.each_msgid do |msgid|
          unless used.include?(msgid)
            last_comment << "\n"
            last_comment << definition.generate_po_entry(msgid).strip.gsub(/^/, '#. ')
            last_comment << "\n"
          end
        end
        result.set_comment(:last, last_comment)
        result
      end
def merge ( definition , reference ) result = Marshal . load ( Marshal . dump ( reference ) ) used = [ ] merge_header ( result , definition ) result . each_msgid do | msgid | if definition . msgid? ( msgid ) used << msgid merge_message ( msgid , result , msgid , definition ) elsif other_msgid = definition . search_msgid_fuzzy ( msgid , used ) used << other_msgid merge_fuzzy_message ( msgid , result , other_msgid , definition ) elsif msgid . index ( "\000" ) and ( reference . msgstr ( msgid ) . gsub ( "\000" , '' ) == '' ) result [ msgid ] = "\000" * definition . nplural else change_reference_comment ( msgid , result ) end end last_comment = result . comment ( :last ) || '' definition . each_msgid do | msgid | unless used . include? ( msgid ) last_comment << "\n" last_comment << definition . generate_po_entry ( msgid ) . strip . gsub ( / ^ / , '#. ' ) last_comment << "\n" end end result . set_comment ( :last , last_comment ) result end
From GNU gettext source.
From GNU gettext source .
# deep copy # plural ################################################################### # msgids which are not used in reference are handled as obsolete. # ################################################################### 
definition
<not_specific>
reference
<not_specific>