—
text/x-python-script,
0Kb
ファイルコンテンツ
#!/usr/bin/python
import sys
f = open('plone-ja.po', 'r')
fo = open('plone-ja.po.csv', 'w')
cln = 0
c1 = 0
c1s = ''
clns = ''
sloc = ''
sid = ''
sorig = ''
sstr = ''
while 1:
s = f.readline()
cln = cln + 1
if not s:
break
if s[:2] == '#:':
sloc = s[3:-1]
if s[:11] == '# Original:':
sorig = s[12:-1]
#sys.stdout.write(s)
if s[:5] == 'msgid':
c1 = c1 + 1
c1s = str(c1)
clns = str(cln)
sid = s[6:-1]
# sys.stdout.write(c1s)
# sys.stdout.write(s)
if s[:6] == 'msgstr':
sstr = s[7:]
stot = '"' + c1s + '","' + clns + '","'+ sloc + '",' + sid + ',' + sorig + ',' + sstr
sys.stdout.write(stot)
fo.write(stot)
c1s = ''
clns = ''
sloc = ''
sid = ''
sorig = ''
sstr = ''
f.close()
fo.close()