Module ActiveSupport::CoreExtensions::String::GetText
In: lib/core_ext/string/gettext.rb

Methods

po_mangle  

Public Instance methods

[Source]

    # File lib/core_ext/string/gettext.rb, line 5
 5:         def po_mangle
 6:           str = delete("\r")
 7:           s = ''
 8:           if str.count("\n") > 1
 9:             s << '""' << "\n"
10:             s << str.gsub(/^(.*)$/, '"\1\n"')
11:           else
12:             s << '"' << str.sub("\n", "\\n") << '"'
13:           end
14:           s.rstrip
15:         end

[Validate]