5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/gettext-one_sky/my_po_data.rb', line 5
def generate_po_entry(msgid)
str = ""
str << @msgid2comment[msgid]
if str[-1] != "\n"[0]
str << "\n"
end
id = msgid.gsub(/"/, '\"').gsub(/\r/, '')
msgstr = @msgid2msgstr[msgid].gsub(/"/, '\"').gsub(/\r/, '')
if id.include?("\004")
ids = id.split(/\004/)
context = ids[0]
id = ids[1]
str << "msgctxt " << __conv(context) << "\n"
end
if id.include?("\000")
ids = id.split(/\000/)
str << "msgid " << __conv(ids[0]) << "\n"
ids[1..-1].each do |single_id|
str << "msgid_plural " << __conv(single_id) << "\n"
end
msgstr.split("\000").each_with_index do |m, n|
str << "msgstr[#{n}] " << __conv(m) << "\n"
end
else
str << "msgid " << __conv(id) << "\n"
str << "msgstr " << __conv(msgstr) << "\n"
end
str << "\n"
str
end
|