Rev | Line | |
---|
[20] | 1 | import wx |
---|
| 2 | import os |
---|
| 3 | import sys |
---|
| 4 | |
---|
| 5 | i = j = 0 |
---|
| 6 | f = open(sys.argv[1],'r') |
---|
| 7 | os.system("sudo rm -rf pofile") |
---|
| 8 | po = open(sys.argv[1]+'.po','w') |
---|
| 9 | po.write('msgid \"\"\n') |
---|
| 10 | po.write('msgstr \"\"\n') |
---|
| 11 | po.write('\"Project-Id-Version: PACKAGE VERSION\\n"\n') |
---|
| 12 | po.write('\"POT-Creation-Date: 2006-11-04 09:59+CST\\n"\n') |
---|
| 13 | po.write('\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"\n') |
---|
| 14 | po.write('\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"\n') |
---|
| 15 | po.write('\"Language-Team: LANGUAGE <LL@li.org>\\n"\n') |
---|
| 16 | po.write('\"MIME-Version: 1.0\\n"\n') |
---|
| 17 | po.write('\"Content-Type: text/plain; charset=utf8\\n"\n') |
---|
| 18 | po.write('\"Content-Transfer-Encoding: cp936\\n"\n') |
---|
| 19 | po.write('\"Generated-By: pygettext.py 1.5\\n"\n\n') |
---|
| 20 | |
---|
| 21 | tokens2=[] |
---|
| 22 | content = f.read() |
---|
| 23 | tokens=('%s' % content).split('\n') |
---|
| 24 | #print tokens[548] |
---|
| 25 | #print len(tokens) |
---|
| 26 | |
---|
| 27 | for i in range(0,(len(tokens)-1)): |
---|
| 28 | tokens2.append(tokens[i].split('=')[0]) |
---|
| 29 | tokens2.append(tokens[i].split('=')[1]) |
---|
| 30 | |
---|
| 31 | for 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 | |
---|
| 45 | f.close() |
---|
| 46 | po.close() |
---|
Note: See
TracBrowser
for help on using the repository browser.