source: drbl_ui/backup/old_langs/trans.py @ 148

Last change on this file since 148 was 20, checked in by chris, 17 years ago
File size: 1.3 KB
RevLine 
[20]1import wx
2import os
3import sys
4
5i = j = 0
6f = open(sys.argv[1],'r')
7os.system("sudo rm -rf pofile")
8po = open(sys.argv[1]+'.po','w')
9po.write('msgid \"\"\n')
10po.write('msgstr \"\"\n')
11po.write('\"Project-Id-Version: PACKAGE VERSION\\n"\n')
12po.write('\"POT-Creation-Date: 2006-11-04 09:59+CST\\n"\n')
13po.write('\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"\n')
14po.write('\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"\n')
15po.write('\"Language-Team: LANGUAGE <LL@li.org>\\n"\n')
16po.write('\"MIME-Version: 1.0\\n"\n')
17po.write('\"Content-Type: text/plain; charset=utf8\\n"\n')
18po.write('\"Content-Transfer-Encoding: cp936\\n"\n')
19po.write('\"Generated-By: pygettext.py 1.5\\n"\n\n')
20
21tokens2=[]
22content = f.read()
23tokens=('%s' % content).split('\n')
24#print tokens[548]
25#print len(tokens)
26
27for i in range(0,(len(tokens)-1)):
28    tokens2.append(tokens[i].split('=')[0])
29    tokens2.append(tokens[i].split('=')[1])
30
31for j in range(0,(2*(len(tokens)-1))):
32    if j == 0:
33  po.write('msgid ')
34        po.write('\'%s\'\n' % tokens2[j])
35    elif j ==1:
36        po.write('msgstr ')
37        po.write('%s\n\n' % tokens2[j])
38    elif j%2 ==0:
39  po.write('msgid ')
40        po.write('\'%s\'\n' % tokens2[j])
41    else:
42        po.write('msgstr ')
43        po.write('%s\n\n' % tokens2[j])
44
45f.close()
46po.close()
Note: See TracBrowser for help on using the repository browser.