Method: PutText::POEntry#to_s

Defined in:
lib/puttext/po_entry.rb

#to_sString

Convert the entry to a string representation, to be written to a .po file

Returns:

  • (String)

    a string representation of the entry.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/puttext/po_entry.rb', line 52

def to_s
  str = String.new('')

  # Add comments
  str = add_comment(str, ':', @references.join(' ')) if references?
  str = add_comment(str, ',', @flags.join("\n")) if flags?

  # Add id and context
  str = add_string(str, 'msgctxt', @msgctxt) if @msgctxt
  str = add_string(str, 'msgid', @msgid)
  str = add_string(str, 'msgid_plural', @msgid_plural) if plural?
  str = add_translations(str)

  str
end