Method: GetText::PoMessage#merge
- Defined in:
- lib/gettext/tools/pomessage.rb
#merge(other) ⇒ Object
Merges two translation targets with the same msgid and returns the merged result. If one is declared as plural and the other not, then the one with the plural wins.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/gettext/tools/pomessage.rb', line 69 def merge(other) return self unless other raise ParseError, "Translation targets do not match: \n" \ " self: #{self.inspect}\n other: '#{other.inspect}'" unless self == other if other.msgid_plural && !self.msgid_plural res = other unless (res.sources.include? self.sources[0]) res.sources += self.sources res.add_comment(self.comment) end else res = self unless (res.sources.include? other.sources[0]) res.sources += other.sources res.add_comment(other.comment) end end res end |