295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
# File 'lib/gettext/po_entry.rb', line 295
def format
if @entry.obsolete?
return (@entry.)
end
str =
if @entry.msgctxt?
if @entry.msgctxt.nil?
no_msgctxt_message = "This POEntry is a kind of msgctxt " +
"but the msgctxt property is nil. " +
"msgid: #{@entry.msgid}"
raise(NoMsgctxtError, no_msgctxt_message)
end
str << "msgctxt " << format_message(@entry.msgctxt)
end
str << "msgid " << format_message(@entry.msgid)
if @entry.plural?
if @entry.msgid_plural.nil?
no_plural_message = "This POEntry is a kind of plural " +
"but the msgid_plural property is nil. " +
"msgid: #{@entry.msgid}"
raise(NoMsgidPluralError, no_plural_message)
end
str << "msgid_plural " << format_message(@entry.msgid_plural)
if @entry.msgstr.nil?
str << "msgstr[0] \"\"\n"
str << "msgstr[1] \"\"\n"
else
msgstrs = @entry.msgstr.split("\000", -1)
msgstrs.each_with_index do |msgstr, index|
str << "msgstr[#{index}] " << format_message(msgstr)
end
end
else
str << "msgstr "
str << format_message(@entry.msgstr)
end
encode(str)
end
|