Method: GetText::PoMessage.new_from_ary
- Defined in:
- lib/gettext/tools/pomessage.rb
.new_from_ary(ary) ⇒ Object
For backward comatibility. This doesn’t support “comment”. ary = [msgid1, “file1:line1”, “file2:line”]
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/gettext/tools/pomessage.rb', line 183 def self.new_from_ary(ary) ary = ary.dup msgid = ary.shift sources = ary type = :normal msgctxt = nil msgid_plural = nil if msgid.include? "\004" msgctxt, msgid = msgid.split(/\004/) type = :msgctxt end if msgid.include? "\000" ids = msgid.split(/\000/) msgid = ids[0] msgid_plural = ids[1] if type == :msgctxt type = :msgctxt_plural else type = :plural end end ret = self.new(type) ret.msgid = msgid ret.sources = sources ret.msgctxt = msgctxt ret.msgid_plural = msgid_plural ret end |